{
 "metadata": {
  "name": "spin"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "# Quantum Angular Momentum Module\n",
      "\n",
      "This file will show how to use the various objects and methods in the `sympy.physics.quantum.spin` module, with some examples. Much of the work in this module is based off Varschalovich \"Quantum Theory of Angular Momentum\"."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy.physics.quantum.spin import Jminus, Jx, Jz, J2, J2Op, JzKet, JzKetCoupled, Rotation, WignerD, couple, uncouple\n",
      "from sympy.physics.quantum import Dagger, hbar, qapply, represent, TensorProduct\n",
      "from sympy import factor, pi, S, Sum, symbols"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## Basic spin states and operators\n",
      "\n",
      "We can define simple spin states and operators and manipulate them with standard quantum machinery."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Define a spin ket:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jz = JzKet(1,1); jz"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$${\\left|1,1\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAACcAAAAXCAYAAACI2VaYAAAABHNCSVQICAgIfAhkiAAAATlJREFU\nSInt1i1LREEYxfGfy4KyoEUwaDSIZl+SwU+gWAwiBtNi2o/gFzBYBEEQzQYFg8mtYhExWMRosClY\nRNawXrhc7q6zs4texZNmzsx55s8DMwy/SMc/DZBWKTMfbrGvgpsuzmmX30E5pEg9x5vBFRpRWF/n\nl7GSt5DtXFqTOMMm3iOgQvMnWAwpWG/hH4jvXEi+htms2a5z36l9bGTNosA94wVjabMocLCLatoo\nEtw9RjWfHRQLDg6xlkyKBgd9yaBocOua3UPv4CYw0GWNcTziNTFC4ZKDKzlrC7jDUWQ+UVXzxrZU\nPTUewTluNV/3Bp5wgdXUvqlP/yFTKzQPQ9hrB5aF61RbXWRrmMuavbwQ/ZG5EqZxmbeQ1lvkAfO4\njswu4TRk42BE8TK2pd6nDhX82fzXn9AHkLc0qQpHOW4AAAAASUVORK5CYII=\n",
       "prompt_number": 2,
       "text": [
        "\u27581,1\u27e9"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Find the vector representation of the state:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "represent(jz)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\left[\\begin{smallmatrix}1\\\\0\\\\0\\end{smallmatrix}\\right]$$"
       ],
       "output_type": "pyout",
       "prompt_number": 3,
       "text": [
        "\n",
        "\u23a11\u23a4\n",
        "\u23a2 \u23a5\n",
        "\u23a20\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a30\u23a6"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Create and evaluate an innerproduct of a bra and a ket:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "ip = Dagger(jz) * jz; ip"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\left\\langle 1,1 \\right. {\\left|1,1\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAEgAAAAXCAYAAACoNQllAAAABHNCSVQICAgIfAhkiAAAActJREFU\nWIXt2D1rFFEUxvGfMRCJqIUgmJQRRDvxJZWg3yCxSaHBQi0sLPwISa2CNgElEJLKQjHprNxWElDE\nwsJgaWGXQJoQYnFdmYyzs3Pnxt0N2X81c84+9zmc3bv3zNDnQPGm2wXkGSjJPW8RH8aXmn7ttKcT\ntCneLzAYs9gNPCiIX8UqdmMWi9A2ErQp3rcwVZRo1bU7eJS5v4An+IWdyOK6pY3RL2MJr6ssOobZ\nkvyC+t9kO23jP/lW0T/GtXyw6D/oIeYSCjmozONePphv0Ckcx89OVNRjbGATo9lgvkH3hU4eVuaE\nHfSXbIOO4hLWOllRj7GOEWEkwN4GTeBdpyvqQRYx3bzJNqhsaDxsHGleZJvyFpOdr6XnuCv8irC3\nQTv4hMuJBudxLHGNbvmOCSf4VjOQ31avhJOsjGYRwwW5m/gmTKWx2nak+Fb1rjQDPsXZXOwM3uOr\nMI3uCuP7B9zOfO7in/iPGlr+naRTfGO9T+KlCpxT/qhRhZmaukaXfAmPGuP5YNHJ9V2YJlP281CC\nNoW6vgO4go9FiSKWZGaBSK7jc03tdk1dqu8EVmJFrV6YlTGIZzJzRCQnaupSfaNfmPXp02df+A0V\naWV8f9YGUgAAAABJRU5ErkJggg==\n",
       "prompt_number": 4,
       "text": [
        "\u27e81,1\u27581,1\u27e9"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "ip.doit()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$1$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAAsAAAASCAYAAACNdSR1AAAABHNCSVQICAgIfAhkiAAAAF5JREFU\nKJFjYKAC4GJgYLhEjEJTBgaG0wwMDP/RJViQ2JoMDAw9DAwMrxkYGP6S4owF2ExmIsWEUcVUV8wB\npblwaRRjYGDYycDAcIUBEnv/GSBRv5+BgSGaFBfQGAAA/84M5lOscPUAAAAASUVORK5CYII=\n",
       "prompt_number": 5,
       "text": [
        "1"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Apply an angular momentum operator to the state:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Jz * jz"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$J_z {\\left|1,1\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAADsAAAAZCAYAAACPQVaOAAAABHNCSVQICAgIfAhkiAAAAgtJREFU\nWIXt10+ITWEYx/HPvaZoQqEm+bOQxEgiGVJkVjaKbCyYLJTybzFZWKtZWGChpJSSIiWFskCZu2DB\nSEh2srTAZsTCMGPxntuce7t/zrxnzkzqfut0ep/n/T3v85y398+hw7Rxb7YTSFNu49+Mp3iJcUzg\nHY5ljL+kha8b7zPGmar+MrpiA5fwHW+mqKs0sW/FiPDxYminP4CD9cZ2M1tlAxbjSVRqk/TiEU7i\nb4H6B9gXER+cFr7ininqKi18N8TPbBb9IPrShqwz248/eB6V1uxwHUfThizFlrALr/GzgKSKYhQ/\nsLxqyFLsRmFXHS4oqSK5iuPVRpZi+5N3pYhsCuYTlgnHVKZid2MML4rLqVBuYoD2xZaF9Tri/1qv\n9ZSoLXY7vuFMyrYJi/Bs5vKado4Is1tT7GFhIxpN2QaEw/v2jKU2yVrMyxljNb7gV73jFM6m2nvx\nO7HHUmnhuyNcCrob+PoT391IfZULWNnIMQdDSYcruC+s12YM4St2YKmwDOqp1LV78BgfkkQnkhjD\nOJTqtz6xf47Uw0Jca5F/ZlYJl+35wi2lr0m/Ss5xzuXQDmJbzvFrKGu9o1dyxj8fqSvjViNjLKXk\nGccKzG3QZyxH/J14G6ndj4c5xq5hC04IO2YPLjbptyAyfhcuSc7HCHL9vKfpxTphvb7CR6yZjsAd\nOnTokOYfv15fmYxfZs8AAAAASUVORK5CYII=\n",
       "prompt_number": 6,
       "text": [
        "\n",
        "J \u22c5\u27581,1\u27e9\n",
        " z      "
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "qapply(Jz * jz)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\hbar {\\left|1,1\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAADEAAAAXCAYAAACiaac3AAAABHNCSVQICAgIfAhkiAAAAhpJREFU\nWIXt1ztoFUEUxvFfQiR6xYAKikZQoiKKgoUPBA0It1axsVCxsEqZxlZSWSgWNgFF8FEpWMRCEYRc\nRAPBRkREwUc6C9HCF4pILGZX914369y9cQvJH5adOTtn5js7e2Zm+U9ZiB1YX9DmRkVaouhuqe/H\nPUxiTYHf0hnsNTzuQE+R/zn0xHZ0Fp/QW9CmkWPbjoeYjh2oTf+DOJT3IBvZEkwJb6Mb7xL7FDYX\nDL4RZ/AWPyIFl/Efw1VcK+qsFzuFN3ES65JrRU7bxgx9XFJ+JmL8h4V8bSKbE9+wMinfxIvketOB\nqNnmIo63GlsTexAfheRaLEzfZ1z+1+oi+SDo688a84KYQB9O4xTuYl8FAmMZxVDWkA2iD1vxACeE\n7++psNQ+r0ZfFC+Fz76WGrJB7E7qA7ggTNtybMF4dRqjuIKjaSUbxGByf4RXSbmOLtyqRFp7dKWF\n1iDeC7OQUhf2i4lqdEVzTJgN/A6ihm24ji+ZxnXcFjahgVkYfAPmd9jHWmHZ/6UzDWIX5gn7Q8pq\nrMJ9HMH3iAFSgbWcZ3vxTFi2y/inDAkr1B+M4CsWZGz9wlFgTDgaZGlkystwB0+E3XY68RvH4Uy7\nTYn9dUtfsf6EFfR8fmzt0+jAd6QD32HhaNRE62ZXBUWn4yK6hbydzHtQhpj8yGOPsISX4YDmnO2Y\nRSV8eoR/la6/NZyBtn6K5pijJD8BAqxjIW7wMpQAAAAASUVORK5CYII=\n",
       "prompt_number": 7,
       "text": [
        "\u210f\u22c5\u27581,1\u27e9"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Jminus * jz"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$J_- {\\left|1,1\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAEIAAAAWCAYAAAB0S0oJAAAABHNCSVQICAgIfAhkiAAAAehJREFU\nWIXt2E+oTGEYx/HPjFt0i0JZkA0LkUT5tyGzslFkY8HNQin/FjcLa2UpSqGUkoVICmWBYhYsNBKy\nlaUFNlcsXFyLd0bHae7MmfedmSPudzPzPr/ze85znt6e98wwQ6ncKruAPNUu+jo8xDP8xBRe4WDi\nfRd20EbxOiF3J/85jCTkVsEnvEhJkqE+TXwDGkLDY+jm34097YRuO6LFaizAg55LK8ZK3MMR/Big\n/w52RuT/zTGhy9tTkmSod9CuiN8RRfzj2JgPFt0RNXzHk57L+vu4jAP5YJFGVLAVz/Glz0WVwQQ+\nY0k2WKQRa4Qp/3gARZXFRRzKBoo0otb8rPe7mhJ5i8XCUYtijdiGSTwdTE2lcRVjrUW3RlSF+dDw\nb8yHPJXWl2wjNuMjjmdiazEfj4ZT11DZL+wK/NmIfcJQnMjExoQXlGtDKa0YKzAnMcdyvMfXduJR\nnMisd+BbM95v6h2068IL0WgbrdbUbkb6W5zG0unEWTjVvOg8bgvzYRDUc+tFuI83wkNM4YNwZO/N\nXLeqGX8X6Yd5uJT6AP2inug/meAdx6Z8MPYn6WEs66A3cCMydxFmR/qqWI+zeSG2ERcifS0mE7xb\n8DLSuwt3E+7dd+ZG+kZwRub875HkP2Zm+F/4BZltWVGn5m3TAAAAAElFTkSuQmCC\n",
       "prompt_number": 8,
       "text": [
        "\n",
        "J \u22c5\u27581,1\u27e9\n",
        " -      "
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "qapply(Jminus * jz)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\sqrt{2} \\hbar {\\left|1,0\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAFEAAAAfCAYAAACf3SEqAAAABHNCSVQICAgIfAhkiAAABB5JREFU\naIHt2VuIVlUUwPGfl5oaL6WgomJWT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szW2wZj4hp3gwmO/rweJOoUfMjaxIm4LVEG5NE6XUwoUvyoAjE/Cqe\n4koxil4sfNbglYLtVWL0XJeTTcxk88R2bEJOVyvpd032XGtCNyvTrS3Ix4ppOycnewpf67jtq/NE\nwZ9OGSWK3qpH/3uEw6lPcWQuEqfi+SJ8vFj014ttXZ5a4X403hZbxHofu8RUzC9BUzL5dkczVYzI\nZaK8WicdqOEiQfZ5aj18PlUTdpUFYup3oBn/sfQ1yk6Iyhgo1u5PUoq+xuEePHuFKKO6ww1iX39M\nUHbCVMZgcV7Z3f+3m34o208//fRzLPIv82vR8KM+l6AAAAAASUVORK5CYII=\n",
       "prompt_number": 9,
       "text": [
        "\n",
        "  ___        \n",
        "\u2572\u2571 2 \u22c5\u210f\u22c5\u27581,0\u27e9"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "We can also do this for symbolic angular momentum states:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "j, m = symbols('j m')\n",
      "jz = JzKet(j, m); jz"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$${\\left|j,m\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAC0AAAAXCAYAAACf+8ZRAAAABHNCSVQICAgIfAhkiAAAAlNJREFU\nWIXt11uITVEYB/DfDI1LzNQIIdF4QEK5ltxGklKUS7xNnjyQSJpX5IkhScqTUnhAyIOHoQ6h5IlS\nHigluT5RyG08rDU5rdln763TIPnX7uz1X9/61v9867+/fQ7/AC78aQFl0JiMRxTEH8ODftKS4igG\nZk2kooswBDfqllMOFawrG/i3YADOZE38aqV/J77hHuYVBVb6XcqvoRknUjLT6AlmYDPG4CV2lFiz\nBssxEx1oxQb0YAG6cBU7hYd/FJriPl+q8rzDe4zD81qbVZLxWBwRbDQtbjq9QHBTXEM43lvYhYbI\ndeI1DmFi5AZEcR0Z+SZhfzVR5Ond2IPvcTF8LlizJAptQJtwOoeEL0yoZKvwkD2N3Ld4jc7I90Qo\n3tBaG1aS8ZSq+y6hQkUYI7TGGVHoomT+LO4kXFuMXVUj51Js6R0UVfpRsrBMj36Bj1gWP+9mCKgk\n3Ep8KsjfUGsiTdaLFnzFtpykKS7jesJNFSq6IuG7cTHeTxA8Xo2TquxRtk8vjIkqGXOTMTjhGrE4\nI75d8PTtKq418qfjuFPwdy8mCaf3oZa4LFFwEG/0PaJ2oXLnEn62bD+fSwTDrBjbjLnYmsx3YXw1\nUaZPE3x4088O0ItXeIs5CT8OD/X180icSrj7OI8DQqfZVzXXHK9neeIqGVyz4OftOev25iWtAzsx\nPyVreXq94FVYLdjiSk7yQXVJy0ajcILpafVBt/DG6xHeQi14LL+Si7Cpfo19sBYbywQOxzBcw3Fc\nEn4P1MJAHJbTQ+tAzT8B//EfOfgB1hltMRlg1uwAAAAASUVORK5CYII=\n",
       "prompt_number": 10,
       "text": [
        "\u2758j,m\u27e9"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "J2 * jz"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$J^2 {\\left|j,m\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAEUAAAAbCAYAAAAqCUKuAAAABHNCSVQICAgIfAhkiAAAA11JREFU\nWIXt2E2IHEUUwPHfbEI0Jk4wojEuomQPKpJo/CYaMys5BAyK4tdBWYIHDwYxiMSj0SCiq4iK4sGL\nYDxERRBRiGgrfhAifoHgQUUQcf26RI3iGtfDq3Z7endmmvlIFOcPTXW/elX1uuq919XFkDnUumx3\nAdZhGS7CPXirX0b9F1mK+wrP1+IARg+POf8O1uAvjKXnOmbE5PxvqYnwyUPvDDEpayu0fX5QRvWT\nkQ71a7EHe4V3zOAjnJnu4U48hA8rjHdsBZ3H8EkFvX7wCBZ227iGn/BBSX4T7lc9YWcVdJ7Co5Ut\n642rcF23jVcLzygm2M1iUuBInFKhn6xbAwbEAuwqCzuFT04jlW+kcgNW4GWcgE1Y2Zt9h4WD2Ifz\nu2n8AqaxBKvws/Cc4lWv0E/WzeADpo4ni4IqSaaGS/A+fsWXOLrPhq3BFuFtU7itg/4V2CgS/gSW\n4xqxOOswiVewTST347EojTFd6mu/WORRfFPV4PxLc2/VBm3I5pGdiIdFKOef99Vt+liU9AnXfxu3\nm0322/E9HjSb5xaIF59o0ecYduYPVXLKeCqzCrrdcAfu0rwh/KON/gYxETURylNiAvItwrTwnF34\nKskOpmtFiz6/EItzVFWjX0xGLqnaoA3ZPLLTCveTYpXbsRKLRcjNYH2p/lm8W5KtSrqXtem3gZvp\n7CkjIp/sE/lkEHxWuG/gzQ763+I3XJrKvaX6hrmTvwm/V+i7RvOkXIgfRXzmnIVj8HqHzvrBsjRe\nJ8NzxvGe5lA7XWwRspLulXgVv+BkkWPKTOBpmiflBpGp9xdkN4pYnLPBGQAXC2OzkvxUsTkskntw\nWXdc5JR3CrLlSf5Met4u3qnImPDAA2WjtqYGOZvFKmxt9RZdkLWpewA/aP5lGBe5YHdJ9xzz55Pd\nmicEzja7jzoPt8wz9iROyh+K+5QnsCMpLBbf7Y0O3eFRI401U5B9J0L63JLuKD41N58cJ4VAgY/x\nnPhHm8Ldpfp6ur7u0u6eyVrI6/gTt7ao3zEQa4Jt4ijkH6r++wyCq0W+gMtF2LzUQveIAdkwIryw\n7HGHlD2pzP+6d4qvzudae8N6XD8ge3o6OugX+T/TUryGx8XmcEsL/YXiAKvbA/ZO9HTINGTIkCFV\n+BvGEKDJmNTtoAAAAABJRU5ErkJggg==\n",
       "prompt_number": 11,
       "text": [
        "\n",
        " 2      \n",
        "J \u22c5\u2758j,m\u27e9"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "qapply(J2 * jz)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\hbar^{2} j^{2} {\\left|j,m\\right\\rangle } + \\hbar^{2} j {\\left|j,m\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAALEAAAAcCAYAAAAuq171AAAABHNCSVQICAgIfAhkiAAABQVJREFU\neJzt23/oXXMcx/HHfjCG75j8nFgb+dXGCsuv2YQ0y5iffyhpf0hJll9/IivSSBIptS8yJWIUMuoQ\nSlIsRCElbURqftsvf7zPbcfZ/d7vuZ977o/Nfdbpe++5n8/r8zmv9+d+7vvzOefLkCG7OBMS6szH\nGZiGM3EP3qmzU0OSGcamAvvivsL7K/EHZiRozccK3IV1WNBp5/7n1Bmb3Zq52IbZ+fsRbBeGtcPQ\n8PqpKza7PRPEDNpIQ04URs1rU2doeP3UFZvdgn1wGo6pUPZpPJDQRorhLyS0s7vRi9g02GX9XoqP\nxIA6f5yyy3G/9haHj2B9k/NVDM860K+bhzG5B+0U6XVssoQ63WRMzyeW3q/F2/hd61Xtkvzv7ZiC\nmRU7sneuX2Q5NuDWihrt6neDDJf1oJ0i/YhNN+qkkqng+XRswhaRr/6WH5+Wyp0jBt6h+XEJTk/s\n2JJcC/bS2vAssY1uMAlrOtSYq/ps3o/YZIn1ukUlz6eIPHU77sTR+XFYocws/JqXKR4jCZ1q1/As\noY1uskLkp6mMqj5L9jo2DJ7fVPT8Ur1Z0aYYnnW5T+0ygsc7qD+q+iCmd7FpkPWonXZo6nn552yB\nGFzrcYBIppfheVyb2PBcXCdmjY24Gd9gv0S9KvqtWIrzcJK4pum4QgyQM7AKr4lv/YE4GHvmbWwu\n6GwSXs3A9/VcSkt6FZu669TlNxU9/wivC5OewAliQfFLhYtrxuF4SCwgG9tocxK1shr098zLw4d4\nF7fYsYq/Az+KnZKZ+blJwrhmA2U2Vlbsf5lR7c3EvY5NllCnTN1+08Tz4u7ECE7Ge2JluwKf5+Jf\ntuhoK24Tt5WLNzb+SdSqQ/8cYeQEkdJsFAZuzz/fLGaKNfg2P7c1Pw5pove1COzUxP5XZVBi02+/\nGcfzxbn46rxBudA23Nuio604rvB6lfjWpZLVoH+Y2BaaK6717NLnz+L90rlZedmLxtBciOvHabcZ\no6rPxP2ITZZQp0w3/KbkeTEnbjyA87HIWYlcZgJeHaezY/FFqeG69xTb1d+Q/z0Xf+KD0ucLxUAp\nciH+Gke71U2FJ0U+WOZIsdJuNpMtF+lDg0GJzaD4zRiev4+f/XeaXo2fRJ7SCdPEHueNHWhkNeqv\nxVulc8eLGeCC0vl1eDF/fZSdvVgtLZ0YVX0m7kdssoQ6Y1Gn35Q8b+TEU3EKnhNPkzU4T6wct9rx\nM5bCWXlnsg40UvSPFTdRikwUM1u57CKRo71XODc9P/9M/v4O4UWD2WK2KXpWN4MYm375TRPPG4P4\ndOyBlwuFj8IRIjG/xs7bHe2wUMwan3Wg0a7+IvHz93Sp7Dzsr7mpH4rbug1mimC9gVPt3P8b8Fhy\nr6sxiLFpVqcXftPE88YgXoC/Sw1tyTu6WORn3zW/nkosFPf7t49Trk79H0T/TymVnSHMKednB+Gp\n0rlPxD7s/WKhUTRvJD868aUKgxibZnW67Te983wnRoTpN3WokyXq391hu2OxQtwKTmVUe/vE3aCV\nd1lCHbrnN2N4Xn6KrS4uF/kRXCxWkq/0SX9Kje02mChmnPLs0g6bxCq816TEpt9+U4/nlZkjfmZW\nilXsV+r5dq5L0D8bV9fQdplluKoLut2mHe8GyW967Pm+eBOP4iVxD7wOGs9aVNWfjAel/Uf3ePTj\nofg6aCc2g+Q3u67nQ4YMGTJkyJAhQ4Z0nX8BhgWzuUASqbIAAAAASUVORK5CYII=\n",
       "prompt_number": 12,
       "text": [
        "\n",
        " 2  2          2        \n",
        "\u210f \u22c5j \u22c5\u2758j,m\u27e9 + \u210f \u22c5j\u22c5\u2758j,m\u27e9"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Find the matrix representation of a angular momentum operator:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "represent(Jz, j=1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\left[\\begin{smallmatrix}\\hbar & 0 & 0\\\\0 & 0 & 0\\\\0 & 0 & - \\hbar\\end{smallmatrix}\\right]$$"
       ],
       "output_type": "pyout",
       "prompt_number": 13,
       "text": [
        "\n",
        "\u23a1\u210f  0  0 \u23a4\n",
        "\u23a2        \u23a5\n",
        "\u23a20  0  0 \u23a5\n",
        "\u23a2        \u23a5\n",
        "\u23a30  0  -\u210f\u23a6"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## Utilizing different bases\n",
      "\n",
      "Angular momentum states and operators are able to go between different spin bases"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "We can rewrite states as states in another basis:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jz = JzKet(1, 1)\n",
      "jz.rewrite(\"Jx\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\frac{1}{2} {\\left|1,-1\\right\\rangle } - \\frac{1}{2} \\sqrt{2} {\\left|1,0\\right\\rangle } + \\frac{1}{2} {\\left|1,1\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAOMAAAAkCAYAAAB7Y41AAAAABHNCSVQICAgIfAhkiAAABcdJREFU\neJztnFtoHUUYx39pq2nTxEukFSy22lSrgvdLtV4riD74IOLlQS1IBK20lSr4ICotVgyKLYpQrJYe\nrUpBraDEK+iqIF4oqBERb4VSFK1YSVXUGuvDt4dsJrOzt9md3WR+cEjOzO7Md/7fNzuzM7MLHo/H\n4/F4RulwbYAnFfstlOF97fFY4FVgumsjPOUyxbUBnkQuA94F/nJtiMcz2XkZOMi1EZ7yUXvGHuAF\nYK4DW5pMWbqdC3wODFsud6LT+Di+CViNTBYc5dSSZlGmbs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CVkGWAlcRfxifRw3Io35PiX9vIzlpEHnt0FgEWN/Yx9wJPLE\nhIpt7XUU8UcWbMTxOD1s3zO2DdRd/ZYAXyGzbWVgqrvNMkanvV3zL2LLcmTT8oj58DFcDDwEzAee\niXy2Yt5QEEcev21AhqTR7XArgC+BJzTl1En7JIrGceFYXITsDFgNvAVcEHNcoHyfDbyB7ElsDwV2\nI0OV6NDrhDB9B/ZIWzfI2tdGi3W3SaubjlnAt2S/yu4hfhim9pRtAuW7Db+dgvSQ65G9tNuQnlGl\nqPYt0i9tuIpja7HYzdhdIdcg3aduUVL9EVnRrU1VwSrEUTbJoptrgoLnF/FbUe1bpGuMTYljrR7t\nYep84E5kHAsyOzcDedLcNp3Jh1hnCrKG95HlcqvUzTV5/WZD+2HSvQOoCXEcq0d7aWMIOAfZqgWj\nQ41vNIXty2kEwPnI0kDVXIG8S8Y2WXRzjSu/2dB+ZcrjmhDHmfXYQvyaV54JApCGvw437++s6gFX\nk26uceU3lw8X1zGOM+nRDzxYoLLJitetXjTeH5cz+mjHdCbAC30qwutWLxrpj+hm3guRbUeDyKzU\nRchVZVf1ZjUKr1u9aLw/5iN7CdU1K//yXDNet3rh/eHxeDwej8fj8Xg8Ho/H4ymP/wEzzZd2JaYA\nVQAAAABJRU5ErkJggg==\n",
       "prompt_number": 14,
       "text": [
        "\n",
        "           ___              \n",
        "\u27581,-1\u27e9   \u2572\u2571 2 \u22c5\u27581,0\u27e9   \u27581,1\u27e9\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500 - \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\n",
        "  2           2          2  "
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Vector representation can also be done into different bases:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "represent(jz, basis=Jx)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\left[\\begin{smallmatrix}\\frac{1}{2}\\\\- \\frac{1}{2} \\sqrt{2}\\\\\\frac{1}{2}\\end{smallmatrix}\\right]$$"
       ],
       "output_type": "pyout",
       "prompt_number": 15,
       "text": [
        "\n",
        "\u23a1 1/2  \u23a4\n",
        "\u23a2      \u23a5\n",
        "\u23a2   ___\u23a5\n",
        "\u23a2-\u2572\u2571 2 \u23a5\n",
        "\u23a2\u2500\u2500\u2500\u2500\u2500\u2500\u23a5\n",
        "\u23a2  2   \u23a5\n",
        "\u23a2      \u23a5\n",
        "\u23a3 1/2  \u23a6"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "When applying operators in another spin basis, any conversion necessary to apply the state is done, then the states are given back in the original basis. So in the following example, the state returned by `qapply` are in the $J_z$ basis:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Jx * jz"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$J_x {\\left|1,1\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAD0AAAAZCAYAAACCXybJAAAABHNCSVQICAgIfAhkiAAAAi1JREFU\nWIXt2E+ITWEYx/HPjClMGaEkUmIhksj/RGYhGxrZWDANKRLSZGGtLEUpKaX8KSn/lQXCXbDQSMjG\nQpYImxGNGYzFe+7MmTv33jnz3u6d1P1u7jnP8/7e9/ec95zzvudSp2rcGGsDaRpHyC/FQzzHX/Tj\nNfaOcpxpZXLNeDPK/rLqT6MptuMGfMPLSH2uRHwFuoSLGcNI+m3YXhgcaabzLMJUPIiyNpwFuIcD\n+FNF/R20RfQPDglXc1OkPlcmd0H8TGfRd2JlOpB1plvxG0+jbI0t57EnHchSdAPW4wV+VMFUtenG\nd8zKB7IUvVh4+z6pkqlacBb78ydZim5NfnPVcFMj3mOmsLxlKnoD+vCsep5qwiW0M3LRjcLz3OX/\nfJ4LaWBo0avxFUdSsSWYgse181U1OoTZHlL0TuGF1Z2KtQuL/5WaWRvOfEyosI95+IifhYmDOJo6\n34zeJF4puTK5q8LmorlIrjXJXYvU5zmB2cUS43A8aXAGt4XnuRhrsQunhDtkH25ibon2uYLz6biP\nt4nhfnwRlsUdqXYLk/iHSD204FwJX5lpMbjDaRO+wOAiZpTQ5Coc81gF2k6sSgeybkPT9OJycrwG\nt5LjDnyKtlae8ZG6Riw3ODEDwdHSIxQOG/EoOZ5cRtMXMU6edXgVqd2KuxWMPcAW4ZaZg1/CR3oD\nDpfRTIocqwknk/5jKPonQkxnu7EM7zBRWNJ6cB2fI83VqVOnTjT/AFLpagvFmvsXAAAAAElFTkSu\nQmCC\n",
       "prompt_number": 16,
       "text": [
        "\n",
        "J \u22c5\u27581,1\u27e9\n",
        " x      "
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "qapply(Jx * jz)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\frac{1}{2} \\sqrt{2} \\hbar {\\left|1,0\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAFoAAAAkCAYAAAAJgC2zAAAABHNCSVQICAgIfAhkiAAABKpJREFU\naIHt2mmoVVUUwPGfZT17DuUDFRWzfDYJkU1a2ZxRQVBEw4cyCAMtGtAPfWggpSKJZoKoFF/ZINlA\nhjZB3YqkAaGygkZBpCgrwwnFrD6s8/S847nnjvlK7x8O5561h7XfOnuvtfY+jxYtWtTHcfi7CVeL\nCixFv94eRG+x1y7Scy7exeZdpG+PZTEG9fYgepPsjB6IF3BgE3VMwudY18Q+/9dcjVki4BzUxH4X\nYUgT+9ttaKahj8JDTeorTX9MwCEFdV78F/Q2lWYa+inFbmgCXsJrWIF5GFmhzwuwXIzz7IJ6pYKy\nduHOauUwMd4HcL/4+4Zl6jyMvtV01ixDj8XcgvJj8CYOSJ4H4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s5cLTPExN1Ot48eI/LSzuT5dTFzJjWg7P9O0clgEXuJWPJRVkgcjJxo\nR8rUvRy+rVPZf4GtDbQ9RaSQ9XChOIepigUqHwr91yk6XSyirzjvLsq2iqj64H8q7mlAUYsqON+O\n471+mvuRdo8mvZs6TXzfWyKykNPFrF6964e1+zJG7NWz+ewe/U8vLVq0aNGiRYsm8g9t9gZJzKYP\nXwAAAABJRU5ErkJggg==\n",
       "prompt_number": 17,
       "text": [
        "\n",
        "  ___        \n",
        "\u2572\u2571 2 \u22c5\u210f\u22c5\u27581,0\u27e9\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "      2      "
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Rewriting states and applying operators between bases can also be done symbolically. In this case, the result is given in terms of Wigner-D matrix elements (see the next section for more information on the `Rotation` operator)."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jz = JzKet(j, m)\n",
      "jz.rewrite(\"Jx\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\sum_{mi=- j}^{j} d^{j}_{mi,m}\\left(\\frac{3}{2} \\pi\\right) {\\left|j,mi\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAALYAAABCCAYAAAD68ywLAAAABHNCSVQICAgIfAhkiAAACjdJREFU\neJztnX2UFlUdxz+7y/Kyygq7WiKVuKsskqxBlFEIu4itlGJ6cH0BJVvIMA4GZOjxnN6OL70g2uZL\nCmimWRYlpZVHrB4tLcKkE2l6ICWPIRb2ImkvENsf3xlnntmZ55lnnzszz+7ezzl7nmfuzHPvnZnf\nvff3cu9dsFgGIDUpltUNHAv8IsUyLZbEORIYnnUlLBaLpd9SlUIZncAwYAawOIXyLJbEOQHoAKqB\n3RnXxWIxxhjnczLw0ywrYhlcVCec/4vOZzvwSM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5iyWPJPfu\nM00tWskykmy3JbP0A7LelL0URqMlSbXI2E1i6ZjFYrFYLBaLxWKxWCyWwcL/AdTvRdeK61V4AAAA\nAElFTkSuQmCC\n",
       "prompt_number": 18,
       "text": [
        "\n",
        "   j                     \n",
        "  ____                   \n",
        "  \u2572                      \n",
        "   \u2572      j  \u239b3\u22c5\u03c0\u239e       \n",
        "    \u2572   d    \u239c\u2500\u2500\u2500\u239f\u22c5\u2758j,mi\u27e9\n",
        "    \u2571    mi,m\u239d 2 \u23a0       \n",
        "   \u2571                     \n",
        "  \u2571                      \n",
        "  \u203e\u203e\u203e\u203e                   \n",
        "mi = -j                  "
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## Rotation Operator\n",
      "\n",
      "Arbitrary rotations of spin states, written in terms of Euler angles, can be modeled using the rotation operator. These methods are utilized to go between spin bases, as seen in the section above."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Define an arbitrary rotation operator. The given angles are Euler angles in the `z-y-z` convention."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "a, b, g = symbols('alpha beta gamma')\n",
      "Rotation(a, b, g)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\mathcal{R}\\left(\\alpha,\\beta,\\gamma\\right)$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAE0AAAAWCAYAAACFQBGEAAAABHNCSVQICAgIfAhkiAAAA+1JREFU\nWIXt2HmIV1UUwPGPjqVS6hQqLaSY5ZhhtkEYOpSELUq2WhIVRFZUQkWIlRhmhmmLtqlhlrQXERSY\n0kYRLWQQ/WNUtljQItG+ok5/nPdr3jzvez+n34z0x3z/eu+ce88979x7z7n30UOn6dVNdoejFQ93\nk/0iwzATTdgD++NyfNeAzSZci8Voq2rYGydhNTbi16xDG7bhN3yB53FaiY1mPILdGnC4M0zE9eib\nk63AU11gu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G\n6IM7dPyQBeKa1IiNFENxe0HWJP7iDNixeQ899PA/5R/opcWRrIlFmgAAAABJRU5ErkJggg==\n",
       "prompt_number": 19,
       "text": [
        "\u211b (\u03b1,\u03b2,\u03b3)"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Find the Wigner-D matrix elements of the rotation operator as given by $\\langle j, m'|\\mathcal{R}(\\alpha, \\beta, \\gamma)|j,m\\rangle$:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "mp = symbols('mp')\n",
      "r = Rotation.D(j, m, mp, a, b, g); r"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$D^{j}_{m,mp}\\left(\\alpha,\\beta,\\gamma\\right)$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAHEAAAAgCAYAAAAlrJeCAAAABHNCSVQICAgIfAhkiAAABW1JREFU\naIHt2nmIVXUUwPHPOKNlZZqlWFZWltqmWYlJOqWJFEVClu31R5tERRsRFYWttpsk7XtJe2CQ7WG0\nQSsWFYoRLZbtZthCZX+c+5g7b+59y8ybN0XvC8N7757f75zfvb/lLHdo8J+nuQ425mF7vF4HWw26\niWFYt6cH0aDBv5qmbtQ9E+ugFSd0o53/PXmT+AhGYSf8IvzZ34msP/rhLszFXxn9x2MAnsMKDKnd\nkDvFMLGY7quDrS3Fom3G+hiKk/FNF/U242xchbWVdtolaXxphmwMluKxnL6bJp9j8VLFw+weBuB+\n9K6DrUk4T5xABW7GwzXS3yp7PnI5VUziPjnyPRP5USV0nInZ1RjtBm7GrnWwsx3OybH/UQ3tzMPE\nShs/ij+wXok2S5XeaQsxpVKD3cBIvFAnW1ehV9G1JvGM7qihnW1UcbqtVD63ewU/5MiahR/oW6nB\nbmA+jq2DnVE4OOP6Mfgcm9TY3mLh7kqyvTgqryzT7kOsyZHtjlerGlrtWY7hObJRuBXX4xY8iMEp\neTWR+/n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TxDvMNLPEkdfVlTtJ\n+MwCrUoEFxXqyKKXCGg+yJCNEAtyYZV2K+Ye7YvNi0WySjz478SReVZybQrGdaE/XCTqiMQxs1T4\n0WImCP/ZWVpwnfYL4RLh/7qiI4vBIoAsphk3al/dqTmvansZ3CT8V5/kd18RoJygLWxegMe70J8I\nYK7AkaIGOaY2t9KgGrrymqi3yAPr8W+X/2pq5RM7Q7PSL5zLMQ7vy65oNKgThyn/ri2P0SII+gD7\n1WxEDRo0aNCgQYMGDXqWfwBhwxNCydgNhwAAAABJRU5ErkJggg==\n",
       "prompt_number": 20,
       "text": [
        "\n",
        "  j         \n",
        "D    (\u03b1,\u03b2,\u03b3)\n",
        " m,mp       "
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Numerical matrix elements can be evaluated using the `.doit()` method:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "r = Rotation.D(1, 1, 0, pi, pi/2, 0); r"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$D^{1}_{1,0}\\left(\\pi,\\frac{1}{2} \\pi,0\\right)$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAGoAAAAhCAYAAAAxvj44AAAABHNCSVQICAgIfAhkiAAABTdJREFU\naIHt2lnMHXMYx/FPqWrR1lJLUcvbUoJWrYmtSmyxJJagtHphDxIubI3YoqkIIi6IEGs0pUhExNLE\ndsGFfU8qqK3SIrTUUuvFMydnet7/zDk9Z87bSs43OZn3P8/M/3lm/tvv/8xLjx4Vcy4Gr+4gusgE\n7FdkXKuLjofjMWxTQV1XYhH+qqCuPFXG2Cnv4RTsMZBOz8K1+BfbdVjXYbi1wzpSVBljVayH+aID\nDSidvoSheAPrVxJNmjWpoeBY3N54smjOn4edsCt+wWv4J7ONFC1+H27D31VHmuMiMTUt76KPgWI8\nZuML0TlG4VIsbrjuKVyFPnzWSsW7ZxXekLB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V0fver8hvXpxsgONxRVY+Gc+KDeY3Fftql0nqs1RXP8UXsdTKiyrx4hqzEM+orpcf\naGV11YfLxIJONNIw6bW3U1/tMFis0/M7D6eYZlPfIXg3Vx4sRtT4hus2EetAp6N+sJhC8p1jkJj6\naud2EXFP6oKvdjhKCJiukmqoQ4S6Ix5mkbqEnyJS+ike0H/t6gYPCUW7pjBXevtTCbVs9L+Zo3w2\neg6eyJUPxV1iH3UfdiyocwfdyXzkORM36XwUVMVYvLQ6A5jR5n2zcVKVgeQ4Rj27MtSa8U8uj0j8\ny9hAiYm1lX8pLuNqnKa+Qa6KydgcT2MLMdVU7WNVmSryiUVLQdc5VSR622UjkWqqajvRJxKhjfm9\nEWU3dZkJolP26NGjR48ePXpUz3+qbzDxAdRwIAAAAABJRU5ErkJggg==\n",
       "prompt_number": 21,
       "text": [
        "\n",
        " 1  \u239b  \u03c0  \u239e\n",
        "D   \u239c\u03c0,\u2500,0\u239f\n",
        " 1,0\u239d  2  \u23a0"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "r.doit()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\frac{1}{2} \\sqrt{2}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAACwAAAAkCAYAAADy19hsAAAABHNCSVQICAgIfAhkiAAAAjFJREFU\nWIXt2DloVFEUxvFfNBDRJEggIgYkagpBMERFQcGtSiF2phEEURBEEMFSQU0KURQURNwaNwTFQohb\nCjGlpakEK0khIgTcUHAr7sSM4+QtM5cZIvOHKd6575zzvfvuOe/eocH/wxr8ivCrGQ8xp9ogsyII\nyUI/nuNrjfJVzQO0xwhUOsNtuIfFMYIX2ICX+BAxJtiLY8LC7o4Y9y46I8b7h5iCe3EuUqxpiSn4\nuuTltRb38QhjuIauvEliCe7B1YTxVXiK+YXrVoziXd78sQRfwvKE8WHhoYrpK+S/kydRVsFtCWNd\nuJ3i/wlvsKDEPoH3GfL/IU3wXNzChYR7zmB1Sp4xfMOSEvtbfE7xBTtx0dQrOVDmnmYcwSA+Kv8x\n6BAKKY15WFhiW1TI/yyL4Dx04AsOlhk7ji0Vxj2JH1hfoX8iV/AKTUW2VqGYKqFHWNdDVeqall7h\n9fUX2Q5jewWxWvACZyPoSmTU1Iy24Im/ZzwLTUJHOZHHqdJN8w78FF7nPqFw8zKEoyW2XRXEyUQz\nxnEeI5id03+38jN7OSlhNXwXWuEg9gsVnpWtOI3HuFmiKdNRaB0OCVvMEWzMmLgTr+U//kyYfgkO\npjm3Cj1wkgGhz+beOdWKlULxLCtctwtPOlA3RSk0CUtisiWtEAT31U1RTm4IG5gZwR6ckv8DUBe2\nCYIJVd9dPynlKW70m4Tz17DQNTYLszxee1npLBX2t6X9MMqfHw0aNJjB/AanNX6i8nBFNgAAAABJ\nRU5ErkJggg==\n",
       "prompt_number": 22,
       "text": [
        "\n",
        "  ___\n",
        "\u2572\u2571 2 \n",
        "\u2500\u2500\u2500\u2500\u2500\n",
        "  2  "
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The Wigner small-d matrix elements give rotations when $\\alpha=\\gamma=0$. These matrix elements can be found in the same manner as above:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "r = Rotation.d(j, m, mp, b); r"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$d^{j}_{m,mp}\\left(\\beta\\right)$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAEgAAAAgCAYAAACxSj5wAAAABHNCSVQICAgIfAhkiAAABANJREFU\naIHt2VuMXVMYwPHfdAyqelGXuFcopS41qqlJOqWjKUIIRdzaeaCpB5fgoYkHQqtoXULcHkpJkLjE\nQ4mEuqSNqpCIlJB0PEgpqkNQIY1WPXx7Z/bZs8/kzDmnc4ac/8s+6/v2t/ZaK99lrXV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8iJtUrwui2RNaFaTXYw50iJxJh\nsFFfQcnSIfLVYpFvKqUVjwkPr5l1+i7LWkS+2DNpjxTJdoH4l4PwhtdqsCeS8b24WtwETqnHRIYT\n5a4iKqFNbNzq9RfVoBhsDqqGVlGpqmWauHLZWZ/hDD+uEJWrGk4RCf0Lw/vA3KRJkyZNGsG/dQzH\nyXC4f9IAAAAASUVORK5CYII=\n",
       "prompt_number": 23,
       "text": [
        "\n",
        "  j     \n",
        "d    (\u03b2)\n",
        " m,mp   "
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "r = Rotation.d(1, 1, 0, pi/2); r"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$d^{1}_{1,0}\\left(\\frac{1}{2} \\pi\\right)$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAEMAAAAhCAYAAACC9hYiAAAABHNCSVQICAgIfAhkiAAAA/NJREFU\naIHt2VuMXVMYwPHf6JSOS6e0SmnGaBXRqFTQxq1mKOoWQlBNTJNqeKiIEOEFL1KESjyQphJBwjRK\nCEI04hLRF5EgvBChYpDUQ1ul0ro8fHvP7O6z957Tc/ZJPMw/2cnZa639rW9/a32XtQ8T/K+5Fd0d\nkLsAZ1cNOKDNCQ7DJvS1KSflPoxgbwfm+AI34PQ25RRyCx7Ev+ivQd5SrOvwHAdjszBwR6hD0Sn4\nFId0cI6UK/FkUUczbrIOWxOFBmpSKM/twhV2dUh+ljewCHNaFbAGf6GnoK/dVZuE73BkxZg6dwbc\nhsdafXgYH5f0tavoJXh3nDF1G2M6fpbzjGazyXn4sEZlslyO9zoku4zfhDEWZxubMcZcHKNzxhjA\nlg7JrmKLJmLgIDbiEawX8WKPxki/Ak+LLTycjNtfekRNMaOkv5k5piZ9fybjiq5/xO7OsgavVCm3\nCr9idnLfhz90buXmay+DdOE1PCBiz3pRm1yEN3FZ8vtcjV5wtSjECjlN7IDlufZteLgNhau4WPhu\nq9yMZZn7l0V2IlJoFQMidoySPQM8hJ0i36ecIiJvp+JFL3a08fzzmd/TxPv8LSrNqlQN25P5R0m3\nzjRcKkrVPZn+CxLhZWm1XaaIBaiDFcbc+WShdxU7xC6anDakxjgh6cjHhgF8JhRuuWKrYC8OKukr\nC4bZK8tqvJ/8nqU8KKekBeTooTA1RrpVt+YGLzHmIndk+po9SZ4hzgFD2CCMnmWXyAZFdDVxpZyP\n48TCSWT2iZ1XRq9IDqNGTWPGNyKy9if3k/GUWLVvMVNkGSJaz8a1uLtisgNF6losguTXeAlnZsb8\nIue3LXKXcPHUNUaEIdKsUkRvMn8hJ+ItPCFWcx5Wiq23AUfkxo9XIi/FV5n7LvyO4zNtM5MXKHOV\nZvleZKaUqfgBV1U8s1KNle94xliNj3JtP4ojdJYRnFoiYxHuFN80Ngt3qIu1ct9POvF5LWWG8Mks\nuzV+WPlEfH36Mtd+KK7Bvcn99XhH7NifatBvIZ7JNrT72a+K7fYNcsQLbsu1va14xefgHnE2IgzR\ng3Nq0K0bZ4ndVgvjuckgPs8psBsn5cZNF1ksv0u7hJukBp2fzLmwNXX3YRler0HOKEXGGDSWLbpF\nPEjTb1qzFPGcxliS5wU8vt9aFjMsisy2qTpJvohXM/cXisPTEJ4VGauIecYKpiJW4VGNbtcKc/FB\nDXKaYqjF59biuoL2K4QxiNqhv0X5KRuV/F1QdwCdJA5JrXA/bhKldMoSHCXqn6PF1p7V+GjTLBdH\njjJ3rZUbcWwbzx8uCrxukU12ajyPlJXv47FAGHyCCSaYYIK6+Q/y58unxR4TVgAAAABJRU5ErkJg\ngg==\n",
       "prompt_number": 24,
       "text": [
        "\n",
        " 1  \u239b\u03c0\u239e\n",
        "d   \u239c\u2500\u239f\n",
        " 1,0\u239d2\u23a0"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "r.doit()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$- \\frac{1}{2} \\sqrt{2}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAADsAAAAkCAYAAAA3pUL9AAAABHNCSVQICAgIfAhkiAAAAl5JREFU\naIHt2E+IjVEYx/HPMEXMTJoayZQGs1BiGoqi/FtNkZ3ZKCWKpKQsEWYWIoqSDDb+pchiapBZyCyt\nZFbKSrOQ1JR/URiLM5Prdu9773vvufcy7rfu4j7nPb/397zvOc95z6HO9KSh1gZSMFFrA9XkIWaX\nIzAjkpFK04Nn+FprI9VgEC3lisR8s824j0URNWE9XuJDZN2S2YsTQhHpiKx9D22RNaMQO9kuXIio\nF5XYyd6QPC3W4AEeYRTX0R7x/onETLYT1xLaV+EJ5k3+b8II3kX0kEjMZK9gWUL7kPBAMume9HA3\nkodE0iTbnNDWjjsF+n/CG8zPio/jfZEeyqKYZOfgNi4lXHMOqwvojOIbFmfF3+Jzgb5lsROX/R5C\nB/Nc14ij6MNHuT8UWoWiU4i5WJAVWzjp4WkR/atGK77gUI62k9hcou5p/MC6EvtXjKt45c+dV5NQ\neEqhU5jH/WX6qghdwpDryYgdwfYStGbhOc4nXZT5VFdgQPF73BfYX4KxTEaEubtVMDwoJJ9m79og\nFLzXOF6mn4JMFPHLxw78FIbgPqHQpaUfx7Jiu0rQqTiNGMNFDGNmyv67cSpHfCDfzWrJd2HJ6sMB\noZIWyxacxWPcyog3qvARzlocFrZ5w9iQom+bMN/SHrmMyz9t+lJqFU2TsL5N0SusoVXbfVSTlUKR\nWTr5v0V4ur01c1RBGoRhPLVkLReS7a6ZoypyU/iQn/bswRn/1uF7SWwTkiVU1o7aWclN2kU8HxuF\ns6IhoTpvEt7uWCT9v4Ylwvdt9lpX9qF2nTp16vw3/AJm7nQeoH85UwAAAABJRU5ErkJggg==\n",
       "prompt_number": 25,
       "text": [
        "\n",
        "   ___\n",
        "-\u2572\u2571 2 \n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "  2   "
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "You can also directly create a Wigner-D matrix element:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "WignerD(j, m, mp, a, b, g)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$D^{j}_{m,mp}\\left(\\alpha,\\beta,\\gamma\\right)$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAHEAAAAgCAYAAAAlrJeCAAAABHNCSVQICAgIfAhkiAAABW1JREFU\naIHt2nmIVXUUwPHPOKNlZZqlWFZWltqmWYlJOqWJFEVClu31R5tERRsRFYWttpsk7XtJe2CQ7WG0\nQSsWFYoRLZbtZthCZX+c+5g7b+59y8ybN0XvC8N7757f75zfvb/lLHdo8J+nuQ425mF7vF4HWw26\niWFYt6cH0aDBv5qmbtQ9E+ugFSd0o53/PXmT+AhGYSf8IvzZ34msP/rhLszFXxn9x2MAnsMKDKnd\nkDvFMLGY7quDrS3Fom3G+hiKk/FNF/U242xchbWVdtolaXxphmwMluKxnL6bJp9j8VLFw+weBuB+\n9K6DrUk4T5xABW7GwzXS3yp7PnI5VUziPjnyPRP5USV0nInZ1RjtBm7GrnWwsx3OybH/UQ3tzMPE\nShs/ij+wXok2S5XeaQsxpVKD3cBIvFAnW1ehV9G1JvGM7qihnW1UcbqtVD63ewU/5MiahR/oW6nB\nbmA+jq2DnVE4OOP6Mfgcm9TY3mLh7kqyvTgqryzT7kOsyZHtjlerGlrtWY7hObJRuBXX4xY8iMEp\neTWR+/nacuE7E71vi40wtEzfJuG6PsEq3ISWlLwlGWOay3Fx4Ufx9i/Qmny+XMJ4H2yLL1PXeuN2\nEb0egXtLDr97GSaCmuUZsul4XuzUM3ASluEpbVWsuVXYWhe/Jd+/T74vEdHprDJ9b8C54thfiEMw\nJyWfiSeK+ryJCeUGtUCkDv1LtNlb7NbbUtc2FrvvNPFwepJJsgOKnfGrO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pq5RM7Q7PSL5zLMQ7vy65oNKgThyn/ri2P0SII+gD7\n1WxEDRo0aNCgQYMGDXqWfwBhwxNCydgNhwAAAABJRU5ErkJggg==\n",
       "prompt_number": 26,
       "text": [
        "\n",
        "  j         \n",
        "D    (\u03b1,\u03b2,\u03b3)\n",
        " m,mp       "
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## Coupled and Uncoupled States and Operators\n",
      "\n",
      "States and operators can also written in terms of coupled or uncoupled angular momentum spaces."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "### Coupled States and Operators"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Define a simple coupled state of two $j=1$ spin states:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jzc = JzKetCoupled(1, 0, (1, 1)); jzc"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$${\\left|1,0,j_{1}=1,j_{2}=1\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAI8AAAAaCAYAAACOyA9jAAAABHNCSVQICAgIfAhkiAAAA9pJREFU\naIHt2l2MHXMYx/FPdav0ZYsLlNCNVhq0TRERF96uCRIsSUmo3ggRL5GIK4oQEm1CiHjJ4WopJWlc\nCGHckV5UtBLESwiieiNkCcVx8Z9hdsyZnTlnZs9ZmW9yMmf+zzzPPL//Pjv/Z2YOLS0tLQ3xKA7P\nMxyS2X+5IMgSfNjHyddiJ7bFibyAY/qIk/B4n3nUSb9zkWUUtFCsJ8JVZYJEPcbPwm50Kya1At/g\nmtTY3diHQyvGSngWj/XpWwf9zkUew9bC7HoW4qUygaLM/il4HR28V3CCXjyAHzCWGjsKB3FjxVjD\nZtC5GDWq6NmKdbMFjApsnVlOkMen2JUzvhdvV4w1SnTM/+JJ01GsZxW2ZwezPU+dLMfJ+DrH9h3O\nbPDcLfXyldCnzmicx/KPrYVV8fanHNs0xrEYv5WItQHXYyW+x611JDgk5quWHZjE88lAk8UzHm9/\nz7FNx9sjsH+WOMdhM24X1ul9QqO5t0Iuz+GMCscT/qhRRZ/ZqEMLw9GzC1PmqHj+jLd5a+mieLuw\nRJw7cQ/+wup4LK8gi9hc8fimqEMLw9FzUOhh1wlF32jPc6DAtjTe/lwizlP4Mf5+Xhz3kwHyGibz\nXcsz2JLsNFk8+4WrzpE5tqXCJJYpno9T3y/AuwNnNjzmu5bPsSbZaXLZmsYenJBjW4MPKsZbgY3C\nbWVVnsbpFX3u0NwfdxAtDE/PanzRyxgVOHYUPwtYi8MyY1vxLRZkEujiphL+aS6K/bIPq5YLr1VO\nLPCtm47qc5EmT8vZuE3oid4UlrW5oqPcc6sHsb6XMSpwnIpPsCTHdmFs25EZXyksT9emxrbjIzNf\nT/TyT/OI0COkC3GLMNldTBT41k0/c5Emq2UZHkrZJ/ELjh8403IU6UlYhFeLgkSZ/aPxhtBdd+PP\nAbyDTanjTo3Hv8yJuVF4DL5NaLh2+u9SVuSfsBuv9LDNRfHUMRcJWS0bzLwDG4/jT9aReA/K6km4\nHNcVBYwGTOjehvzH8Qdu6WGf6ytPGapoWSAsW8mV6DRBU9W+pklelHnCXPfd1uIa/a8Qege4RJjY\nvPdko0oVLV2879++4y7h5yt7Gs6xLBPC0/Bfiw6KBjjBubi6Jv/1wkTeL9yZfKb4qjZqV55BtNyA\nh83s7YbNfQoa5YSoz+Bjwn9Kv4Kz/svwFp7Aa8K7oCJGqXgG0XKxUDyEu7WJZlKsxJjiHwn+Q9Rs\nHo0xSsXTL+cLhXNs/LkM5ww1o8ClZmmUE65sNo/a2YQnheKZws3DTadvThKetnczn/Eipzlim+Jb\n+JaWlpaWlpaW/zV/AzTy7joiuTv9AAAAAElFTkSuQmCC\n",
       "prompt_number": 27,
       "text": [
        "\u27581,0,j\u2081=1,j\u2082=1\u27e9"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Note that the Hilbert space of coupled states is the direct sum of the coupled spin spaces. This can be seen in the matrix representation of coupled states:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jzc.hilbert_space"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\mathcal{C}^{5}\\oplus \\mathcal{C}^{3}\\oplus \\mathcal{C}^{1}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAGYAAAAZCAYAAADDq1t2AAAABHNCSVQICAgIfAhkiAAAAuNJREFU\naIHt2U+oVGUYx/GPpek1I/zbNSIvSa40rbtIEtp4ixQqlMxFlhIiim5EQQKDiYx2IRRERboxKMid\n3oR0EyhKBS5SSUI3Jl4Qysr+GdjieQfPjHPv3OMZ70zN+W7e8z685zm/mec9z3mecyj537AH/+BP\nfI3+9sppyJN4GeuxDwPtlTMi9+BzPFjUUQW9mF3U0W3kMtam41X4XfwBncZ68X9eR19RZ5WiDsaA\n+bg7Hb+AazozMFVuCsz4W3DSg024gqV4B6eKKmsx32WOV4rN9Gt7pLSeuXgLJ/ETfsbzWIO70poB\nfI872iHQ8BrhMWzHR5jcFnXBSBqrjCqVjccbGBT5uR+vp5PfVXuX9SX7wiLKb4FmGrNswLeYMpYC\n5dPYNJVNwKc4g+UZe08afxQpbAb+cCNvXyvwA/IyGo1DWIzz+Aof4BlR/XSCxoPNHNQHZjfuxM46\n+zp8I0rPSSIosATHcDqHaJiIF/GoqO6GRMAHcaLJuc00HsbTuJjsD4mNc7KDNB7KI2QAf2FOnX0G\njmBemj8rcvcOfIxZeS6Cp0QvtCTNK+I2noRX8D6mF9S4BtuwFftFoDpNI7yUfF0Xd9iWRg6P4rN8\n+nOzAm9iXMZWUZtf7xMipzU4v+s0PiKitqpVDhvQK+6weipurkjuFzspS1dprJa5y9LYLHcWYSPe\nHuXaiyKnZ9NBV2msBmZBGi8VdTgCffghx/ov1L7j6iqN1apsZhp78HdRp8MwR1Qr9SwWL/B+qbPf\ni7OZeVdq/ETkxuHews4XFU4R9g5jr2jc9T6OVzPzrtJYTWXH0/iaqL+zzMUB0a8U4ZzaUrEZy/Bl\nZt6VGifjgoj2oXTBfmwW5V8rvrnMMvqK5wG8V2oMHhYPs6v4LTnaJJqqVvEcdhm5R+gVfcDUUuPY\nslTsyifSvKK2q/5QdMntpO0axzVfcluYiNVYJBq1IfG9ZFDx50Sr+C9oLCkpKSkpyc2/Pkneg0NI\nsz0AAAAASUVORK5CYII=\n",
       "prompt_number": 28,
       "text": [
        "\n",
        " 5    3    1\n",
        "C  \u2295 C  \u2295 C "
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "represent(jzc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\left[\\begin{smallmatrix}0\\\\0\\\\1\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\end{smallmatrix}\\right]$$"
       ],
       "output_type": "pyout",
       "prompt_number": 29,
       "text": [
        "\n",
        "\u23a10\u23a4\n",
        "\u23a2 \u23a5\n",
        "\u23a20\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a21\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a20\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a20\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a20\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a20\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a20\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a30\u23a6"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "We can also couple more than two spaces together. See the `JzKetCoupled` documentation for more complex coupling schemes involving more than 2 spaces."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jzc = JzKetCoupled(1, 1, (S(1)/2, S(1)/2, 1)); jzc"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$${\\left|1,1,j_{1}=\\frac{1}{2},j_{2}=\\frac{1}{2},j_{3}=1,j_{1,2}=1\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAQMAAAAhCAYAAADdws5CAAAABHNCSVQICAgIfAhkiAAABSNJREFU\neJztnUuoHEUUhr/oFWO8uUaRaCJKjEJ8JWhQVNREowSJokGuIZBo0IggiCTqRtwoRA0+N0GRaBhQ\nLxd8LwQ1YhSCG3GjWSgI9tIXKAgufF0Xp5uZO+npruqqmq4uzgcDPdN1qs/fdbrmVFX3DCiKoozg\nC+DUtp1QFMU7dwILRu08puSz5cBkMHfSYDHwFnBW2454ICUtSjVnAtfbGGTAihCeJMI9wGPAHN0/\nTylpUepZBszYGGRoYJiQ0gWUkhalmlngtLIdZcOEOhYBXzs442oPsM9DHTGRkp4YtPiIMYhDiy11\n2g8Ad5ftsO0MLgM+B1Zb2vmyLzghrycVUtLTthZfMQbta7HFRPtBYAMlE4kThgc5H3gW+AX419JB\nH/bD7PRQR0ykpKctLb5jDLrTLjba54BPgI3AR3UVZ1SPH3t5hU1xtY+FlMbZKWmBdGKsCT3qtS9F\n5g7m0WTOQFGUbvMzkkEsG/zQdJgQA2uAuxABPwK7WvJjG3B1vr0XOIxMNNkSg56UtPgiJS1VvIoM\ng/YUH3SlM1iOzIA+iIyPjiBivrGs5wCw1tJmF/DZwPs38td9lvUM4kOPapmvxQe+4syGtrQfAh4B\nngT+G1UoI745gxeAJfn2Lbn9Kgcf2iYlPTFq6dEsRmPUYksPc+0PA5uKN12ZM3gZ+D3fXofMmn7X\nnjvOpKRHtXSXHjIkArrTGXw7sH0t3Vr7LSMlPaqlu/yK9AEnQ3fmDApOAi5GerQm7AcusbR5iH5Q\nmKRfI58KK8FFj2oJd7G6xpkNbWqfQLT+NqpAhtucwSpgYSD7m3Lbi0r2xfj0Xd25KNNzObAbeYDo\nIJKuxkATLeuAO5AHol4Hbgjm3Xx6uMWojzhrqx17mM8ZbKZmtSSjujOYzQ+2qGTfdfm+NwPZP4OM\n44a/sWJ8+s7kXAzrmUSW+Aq2AH8CZ4Rw0IImWkDS0B359u2IlsUhHBzCNUZd46zNdqzSPsw7wClV\nBTKOFroUuXXxSH6gOeRkHULWqgsuyD//wbN9wZfA2xW+x9QZ1GmBo/WsQZZ5zsnfTyGatoRw0IIm\nWkC+WU/Mt6eBvwnXGfiKMXCPs3G3o6n2QVZgMAzKcL+gHg9gPwX8AzxQYTeOzsA2/Rt1Lsr0LMjr\nL76RLkQ02Y4pTQmpZZgZ4FFL/0LioqUuzsbdjk14AriqrlCG+wW1t76Ikf00/XXe7cgtlGdX2IXu\nDJqkf4PlbfW8Bjxn76YR49KyFlnP3o9Z6jouXNrFNs5CtmMTJoCPTQpmuF1Q1wBbPdivRk76HmTG\n83vqM47QnYFt+jd4Lmz17ASexm5G34ZxagG4F/iKOH5Sz1WLTZyFbscm3Abcb1Iwo/kFNQE8T3Ph\ng/aTyKOWLwLvMXBzRAWhOwOb9G/4XNjouZn+47MLCaMptJYrgJ/of8Oel9c/7cF3F1zapcA0zsbR\njk14F+n4asmIx2lbxj2BGCL9W48E0On5azNwpedjlOFby6XAp8Dx+ftNwF/AuR6P0RZlcbYB+XGR\ngrbasY6VwCumhTO61xlsA15CGmkWwxTIkRDp30rgD/ozwsVryuMxygiVym5HbpDZjczOb/Rc/7ip\nirMZZKkO2mtHE55CMkIjMrrXGYybWNO/JqSkpW121BdpleOAD0ft7MqzCTGxHvl12Q+Q9O9Ghn4k\nokOkpKVtjiWu1ZIybgXetzHQf1QaTczpny0paYmBrbR/p2gd+9D2VRRFURRFURRFURRFURSlCf8D\nTSec3ofIo5IAAAAASUVORK5CYII=\n",
       "prompt_number": 30,
       "text": [
        "\u27581,1,j\u2081=1/2,j\u2082=1/2,j\u2083=1,j\u2081,\u2082=1\u27e9"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The normal operators are assumed to be diagonal in the corresponding coupled basis:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "qapply(Jz * jzc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\hbar {\\left|1,1,j_{1}=\\frac{1}{2},j_{2}=\\frac{1}{2},j_{3}=1,j_{1,2}=1\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAQ0AAAAhCAYAAADDC/7xAAAABHNCSVQICAgIfAhkiAAABelJREFU\neJztnXuIFVUcxz/WRrbubhmhrVLZWthLKaksqmupSC9UYhOhLSmjCCKy+iciSqiUrOwPKWJLbliL\n0MMMispoqz+kiKCHfxRIDfRH9A6iKHtsf/zOcGfHuXfmzDlnZu54PnDZef3OPd85vznzO6+74PF4\nPAWxBzim7Ex4PB7rXAdMaXfyEIOEZwF9BvYHA/3Ai8DxZWfEAnXS4unMccBSFwkHwBwXCdeEG4H7\ngQm6/z7VSYsnnUFgTMdgGnAucHLKdQHegbJQpwetTlo8ndkBzEw6EW+erATeBz7E3Dl6gc9KtAfY\naiGNKlEnPVXQYsPHoBpadEnTvg24IelEvNLYBbwH/I5UHnk5R6UzvyT7kCNUOnWhTnrK1mLLx6B8\nLbpk0b4bWEJCh2hPZPtopMnRi1QmP6njAXBGxsycCjwC/AD8m9HGpn2cdRbSqBJ10lOWFts+Bt1T\nLjraJ4C3geXAm+0uOhxYpC6+DzhJfQbbXB/QuQnTVGnlxdS+KtSpH6BOWqA+PpaHJunaZyB9G5OI\nRhp/IcOoAK8C+2zkzOPxdC3fIxHJIPBteDDep9EAfkM6SKYD25H+jWeLyaMVFgBbkBry8RLzcQ3w\npNreBNyaM50q6KmTFlvUSUsnniHW/OqJXdBAZnoOAJuBjWp7RRG5s8AspMf3DqT9thcR/blmOtuA\nhZo2twPvRvafV59bNNOJYkOP1zJZiw1s+ZkOZW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gCZrrwf+VmGbifJz5YgP4ITUlY5pjEEPG070YDuqzTC1ZoTyJCT1dCrDS7CziFkmv9E\n7DNg8TuScBVCjyATkdYjoxHLLadfNJ38bAwZwoTyyjELG5EI0yoB3VdpFE1Vw8481ElL2axNv6RU\nDgPeaHfS5P+eeDqzGFnw9xoSdl5K+19Bqzp10lI2h1Kt0aEkViLzs6zj/8Nae6ocdupSJy1VYA3l\nz9xNYyu+fD0ej8fj8Xg8Ho/H4/F4PB7Pwcz/kmrHd1bpdrwAAAAASUVORK5CYII=\n",
       "prompt_number": 31,
       "text": [
        "\u210f\u22c5\u27581,1,j\u2081=1/2,j\u2082=1/2,j\u2083=1,j\u2081,\u2082=1\u27e9"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "### Uncoupled States and Operators"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Uncoupled states are defined as tensor products of states:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jzu = TensorProduct(JzKet(1, 1), JzKet(S(1)/2, -S(1)/2)); jzu"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$${{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAHQAAAAgCAYAAADDhVzGAAAABHNCSVQICAgIfAhkiAAABCtJREFU\naIHt2lmIHEUYwPHfxtWEJYl4EI2iWRPEI0QIoiGeaFSCBqMRokRUTES8Hgz44pNRFGM8UVEUo8GL\ngBoVDHiBK6KggooK+mCw34IXokJAYV0fvll2pjPd090zmZ115w/D9FTVd1R/U1VfVTd9+vxP+ASH\nTrYTJbkaA3kNZnTJkV7kCMxuUj4Hr+Lo7rpTyPZRWNE9d6YWCYZTZddhE8aa1O1ritiej5fLKH2t\nLZemFonsGzcZAS1qezsOy6p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K9v36t7p15Qi0Tygq0w8lpqV0WZf0cr2/ng7T0GvHc5PNmeLN+p2ikd1K8XxYa/Y\nXi1e2enThPSb8wvFA/Kx1GduF3wpavvxLvnTp0+fPn36TDv+AxMh2obP427zAAAAAElFTkSuQmCC\n",
       "prompt_number": 32,
       "text": [
        "\u27581,1\u27e9\u2a02 \u27581/2,-1/2\u27e9"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Vector representation of tensor product states gives the vector in the direct product space:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "represent(jzu)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\left[\\begin{smallmatrix}0\\\\1\\\\0\\\\0\\\\0\\\\0\\end{smallmatrix}\\right]$$"
       ],
       "output_type": "pyout",
       "prompt_number": 33,
       "text": [
        "\n",
        "\u23a10\u23a4\n",
        "\u23a2 \u23a5\n",
        "\u23a21\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a20\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a20\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a20\u23a5\n",
        "\u23a2 \u23a5\n",
        "\u23a30\u23a6"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Uncoupled operators are also defined as tensor products:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jzopu = TensorProduct(Jz, 1); jzopu"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$${J_z}\\otimes {1}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAADQAAAAYCAYAAAC1Ft6mAAAABHNCSVQICAgIfAhkiAAAAkRJREFU\nWIXt1k+IjVEYx/HPnZGpMRaGJkppFmIi0YTxp8mfbNCEBeXPCiOahYmyUSzGQlFqGgv/ZrKQlWaL\nQilCEYmVspOGBaKYZsbieSe3y33v7b5TE+a7ed/znud9nt855znPOfxnLMFtPMIwRvAc7eMpCrV4\nkcVBDh/xdEzkZGMpnojJ/Y1JZTpZiHpcHCNRldCEMxjAUDGjcge0JnnezaYJ1GA7msUsj+A7+kVq\nF+M1NiXvfVieRcQNDGJKFifYgF6sEmk8ylQcwAVML8NPnyIpVw45fMDDSh0kbMUzNKbYdIoiVF/C\nV58iA6oqQ8giMWtZ0m0m2sTKHMf8P9gcxBfsx6lKA5UzoLXJ816lQXAIp/FNCO8UR8IoR/EJl/A2\nsZuTIV4q/fgh2/65WtCuRjdW4wS2FPSvw94Uf30qTLkqtIq6/7WEbRrDBe0hHEZP0u4v6H+HhkoC\n5Q+oRWz+I3nfFmMa7lTivEgcYoXOoUMUncIVmoX3WQPtFpv/c963PWI2r1XiPI83WJC8T8Z5XMF9\nnMRc7Myz3yiqXSY6cCyvvVnsnY6sjkX69Io72GXFq9w+UQy6S/i7LvZQbZpRNbrE9aJH5HVrin2X\nuIasFGW5pYSINuWdQ7dEmhfSgJt46dcNY0AcJ7tKxC5JI7ahTlSjZWX+t16U5hV+vym0J30zsgjL\nlTZJZXQPFlaxNGqwQ5xDI4mGQZERDzLqyUROpCnMFkL/WprF6T9P5PbZ8ZWTjSZRperwGK9E2Z1g\nggn+AX4CKbZnF2vuuR4AAAAASUVORK5CYII=\n",
       "prompt_number": 34,
       "text": [
        "\n",
        "J \u2a02 1\n",
        " z   "
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "qapply(jzopu * jzu)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\hbar {{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAH4AAAAgCAYAAADUp8wPAAAABHNCSVQICAgIfAhkiAAABOJJREFU\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ibXO+Je8QrzXXHAsb/YzpU5SQRA\neejK8aukFXUuarvMyXi5WsY80ZtOrEibmqRdgnPFUV+ZvgwDTyY61QKvY5O8pzN06+mXuS3lSzUm\nyR/VT8XdNcoqKR7V56lzO3hOxpZ1Kf7EThVpU/Cj2M5NT8n3VVxPElHj56KS/Yne22LPWWZGkv5d\nqqy8+sTOY0X1ug3iFHyCfWvILMIbYu3LoqR4w2fVuZ10i+CuJfQ1obu0Cd1FGgvC5okt2xwDp8Hx\nuDjJq/d1Tcnghp+d+LJELBFz1aaZOqdp1PaNOLJVxvua0F1WUG87PF5Ab7T4FKn8nn65eKN3RE79\nkoENP87AOpwh4o1abxOL1jlNo7ZHiRmtZeQNhNIcjbMK6o6UY9mDxXZxWnI/QSxPZ2ToN1PnNI3a\nPl2LXyePL6AzSoy4vPvXNMP1IUbJwIbvEtNtuR4zxcOfZTDN1jlNI7bhebGN61CAktrB3aO4vS2e\nNGa7R8QwHQpSkt3wC0W80KoR3Qj1bDfyzUGHKpRUb/iTbT3uHJMhM1TUs72DOGXNpPNdfTGOEQdY\na8QR8Amqf6k0XLbni/cvHZog/Z80PeLksj/1m9AGX/LavqdN/nTo0KFDhw4dRhj/AllqCrlzA7Px\nAAAAAElFTkSuQmCC\n",
       "prompt_number": 35,
       "text": [
        "\u210f\u22c5\u27581,1\u27e9\u2a02 \u27581/2,-1/2\u27e9"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Coupled operators which are diagonalized by uncoupled states (e.g. $J_z$ and uncoupled $J_z$ eigenstates) can also be applied:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "qapply(Jz * jzu)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\frac{1}{2} \\hbar {{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }}$$"
       ],
       "output_type": "pyout",
       "png": "i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fZFG5L3memIpe544jDrS\n8A4yA1+X0J0SUxW9+A8wt4S+TuidgE1k8eP4IZmLfsTcvQceFvNvnQV4Toy8/tQWtGBHTGqzjFli\ntP/eJP1zzMmuN8CtYiv5NXFotYNYytY5VARsqbSy6dAX1In2VtGb5zA8U0XpfNErDxnybGb27Eyc\nKI6A6wwUlPVQJtcoWDwwS3ukonyd63L1yTNd+mplJm4uKKum+molpb2jxeOqLdktwR/YcMizrfGt\nWMrOzuUfyN1PF9Hwh8IYg5nsK2JdXmfn7PmXFeWJVdUdCW06HO9iu4I8i/GimIebUVO9czRr72jT\nJwLShuwtDHGpcJ/zmmVMZKBN+SVtyC6WHjzOF8vVuYa73Ck4I0tr9ZVXTePOUcam7bS3Hb11rsC+\njRImi520OseIubrVDmMRA23IMrw+ZRiPB0rKTBSfzNXPVZaKndN9EuVr/t85ytq0anvzVHmXE4R3\nbMiuYmk3K7ufKtz2MW1Uskzwlmd/HFdRdk05si9j03bam6fKuzxawRb7OOGK6m51Tlbg7s0EEphS\nUW6CGL2p6/s83fjYp+b/nSPVpu22N0+Vd/mEWMImsQLXV63dOkhN64C0WzZtpbdfxFVJLBLzbad6\n8rpATXHn6JZNU/Qmf7dymNXHtpOM/ZPG0aKmua26ZdMUveuLE/aGDN1CPkAcoq0Ux9kLNf7Cq0c6\n3bJpqt4jxB5VIf3ihHUw95vaocqu7TT6j7du2bSM3ltGoT49evTo0aNHjx6F/AvANSXYBnfGVAAA\nAABJRU5ErkJggg==\n",
       "prompt_number": 36,
       "text": [
        "\n",
        "\u210f\u22c5\u27581,1\u27e9\u2a02 \u27581/2,-1/2\u27e9\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "         2         "
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Rewriting states works as before:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jzu.rewrite(\"Jx\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$- \\frac{1}{4} \\sqrt{2} {{\\left|1,-1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }} - \\frac{1}{4} \\sqrt{2} {{\\left|1,-1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }} + \\frac{1}{2} {{\\left|1,0\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }} + \\frac{1}{2} {{\\left|1,0\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }} - \\frac{1}{4} \\sqrt{2} {{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }} - \\frac{1}{4} \\sqrt{2} {{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAA8EAAAAkCAYAAACpKTisAAAABHNCSVQICAgIfAhkiAAADd9JREFU\neJztnWusJEUZhp+FhSULu8SVOwJHlovKTRRFEEVYEQWCioJGIgQwCngF0Wg0ClkJaLiJqJEojKC4\nBkSMouB1jAkRjVc08kNixx+iYEAlEEQRf9ScnJk+fa+qrqrp90lOzpnpqa7vdD9TX3d1dTUIIYQQ\nQgghhBBCCCGEEEIIIYQQoXjKwY8QKXAI8l0IIcQwUM4TKSFXRe98G9gqdBBC9IBcF0IIMRSU80RK\nyNc5YbPQATTklcCPgcdDBzIg7gK2Cx1EB04DVoQOwgK53j+hXE/d1XlC7Z2wRe1IN5TzuqE2Kwzy\ntRtRto+pnASfC3w2dBADYxdgm9BBdGA3YEPoICyQ6/0TyvXUXZ0n1N4JW9SOdEM5rxtqs8IgX7sR\nZfvo8iR4DXALsLv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NF3nWw871p2T5czRPyexwzrh2wJVaH5E85\nrnNmTA4o58WHjtHKka/x4dLX2HwTQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBC\nCCGEEEIIIYQQwo7/A1+H0IgzacuTAAAAAElFTkSuQmCC\n",
       "prompt_number": 37,
       "text": [
        "\n",
        "    ___                        ___                                            \n",
        "  \u2572\u2571 2 \u22c5\u27581,-1\u27e9\u2a02 \u27581/2,-1/2\u27e9   \u2572\u2571 2 \u22c5\u27581,-1\u27e9\u2a02 \u27581/2,1/2\u27e9   \u27581,0\u27e9\u2a02 \u27581/2,-1/2\u27e9   \u27581,\n",
        "- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 - \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\n",
        "             4                          4                      2              \n",
        "\n",
        "                  ___                       ___                 \n",
        "0\u27e9\u2a02 \u27581/2,1/2\u27e9   \u2572\u2571 2 \u22c5\u27581,1\u27e9\u2a02 \u27581/2,-1/2\u27e9   \u2572\u2571 2 \u22c5\u27581,1\u27e9\u2a02 \u27581/2,1/2\u27e9\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 - \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 - \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "    2                      4                        4           "
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "### Coulping and Uncoupling States"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The `couple` method will couple an uncoupled state:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jzu = TensorProduct(JzKet(1, 1), JzKet(S(1)/2, -S(1)/2))\n",
      "couple(jzu)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\frac{1}{3} \\sqrt{6} {\\left|\\frac{1}{2},\\frac{1}{2},j_{1}=1,j_{2}=\\frac{1}{2}\\right\\rangle } + \\frac{1}{3} \\sqrt{3} {\\left|\\frac{3}{2},\\frac{1}{2},j_{1}=1,j_{2}=\\frac{1}{2}\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAAkCAYAAABi4faKAAAABHNCSVQICAgIfAhkiAAACSZJREFU\neJztnWusHVUVx3+33Kal1iKkPGuxVBRUKFoxVhvLRY1poKl8wKJRXhYIMT6hMVH8IJGo8QUigWCF\nDqBY5OELDIJfKAmWBKLBB0/N+IgGMI2BWFEe1w9rxjvnnJk9e8/eM7PvOeuX3PR2zqx91jpr/8/M\n3nvNvqAoiqIoiqIoihITxwOzAX4UZVJQzSgTwc+AxX07oSjzCNWM0hsLOnqfjcA9wHOB2rsPWB6o\nLWU8OAOY6tuJgKhmlLYxaqari8NHgKsCtncYsDRge8r8ZyXwrr6dCIhqRmkbo2aGLw4vB24BDg/o\nwHrgIeCZgG1W4eN/G7ErYbDJzbXAh7txZ4D5rJkNwOnAOcB3gXc3aEN1Ey91ubHWzDnA55EFrFUB\nHMu5GTgwYHsAKaM++vjfVuyKPy652Qkc3LI/Rea7Zv4BnJn9/j5gL/KFYovqJl5sc+OkmZCJPg74\nZqC2iqRU++jjv3byeLHJzXuAz7TvygjzVTPHAC/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vGez2D/d5tnmEzNNLEfV82AWzxtawbcc+OkGZ+93bsgZfBuYgoZRuVzfPnTiVUr/u9Atgn3\ntT02O/cSZPj2BNV3FBDnXVAej2ssm5jbi2Ux7cTlmhuAHyL+d80kacbVflw1A27xdKEZcM+tlWbW\nIle07ZQvxsRCivmDNQ3bppF1jqoyOxfbpcgc85XIvlBnG3yC+Dp6MR6XWE5AOvkh2c8pyJxq29QN\nx1cj88Ndopox24+zZsA+nr40A+bcOmvGZ2/3Lkip7jBbga/Q7K+B+diaCLWxXwysRipjZod+yjaU\nC4lNbr6E3DH1waRqJoR9GaqZMNTlplYzw3u7H404f2ogB0OTUt7RfYZtXQ35FHdscrMQmVvtCtVM\nGHulPepyY9RMviA9Dnu7n4Bs6HcHMmzbiP0ffPGxVdrFNjfvBX7coV+TrpkQ9kp72OTGWjO+e7t3\nyX0M7kDpM2zrc8inmHHJzRUVx9tkUjUTwl5pD9vc9KEZRVEURVEURVEURVEURVEURVEURVEUZdL5\nH3bROXO1FYCoAAAAAElFTkSuQmCC\n",
       "prompt_number": 38,
       "text": [
        "\n",
        "  ___                           ___                      \n",
        "\u2572\u2571 6 \u22c5\u27581/2,1/2,j\u2081=1,j\u2082=1/2\u27e9   \u2572\u2571 3 \u22c5\u27583/2,1/2,j\u2081=1,j\u2082=1/2\u27e9\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "             3                             3             "
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Similarly, the uncouple method will uncouple a coupled state"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jzc = JzKetCoupled(2, 1, (1, S(1)/2, S(1)/2))\n",
      "uncouple(jzc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\frac{1}{2} \\sqrt{2} {{\\left|1,0\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }} + \\frac{1}{2} {{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }} + \\frac{1}{2} {{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAmYAAAAkCAYAAAAjI/bEAAAABHNCSVQICAgIfAhkiAAACyFJREFU\neJztnWvMHUUZx38thZK2b42VSwsBjrSKiqB4IwWU0IoiElGUaiRCoEalXgtoYjTa5tUUTaFQ8Ua8\nHMFLjVggsYr3Y0xI1CgqGvkgceMHUTCgURptrPXDs8d3d89eZnZ2z87ZeX7Jm/bs7Mw+z+z/mTNn\ndmYWFEVRFEVRFEVRFEVRFEXphucBhxr4UxRFURRFURz5JnBk10YoiqIoiqL4yuIpXecC4EfAv6Z0\nvb5wL3BUB9e9HFjUwXUhTJ+VNF1pwBWNG6VLQtRAL9uKaXXMtgCfnNK1+sRxwIoOrnsCsLGD60KY\nPitputKAKxo3SpeEqIEg2oo54A7gxAYNOBv4UIPlhUQEDHKOu96nqvxrgC/XLNuViHyfwc1vn31u\nI+5mmYh2NOCKzxqKCKut0JiZJCIsDUBP24rkiNkbgWuBV9PsSNq7gJsbLC90XO+TSf6H4rRj6xjY\nEi5+++xzW3HXR7qsK581VERf2wqNGX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na2tFlc/PbZZ407c7qsK581VERf\n2wqNGXP6qoEqetFWnIy8EzK7n9jKBo1V7LmX9FJh1/tkmv8WizKbJuszuPnts88ad/k0rQFXfNbQ\nmFDaCo2ZYkLRQBJtKxRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFmT7/A1TuLADP\nlUklAAAAAElFTkSuQmCC\n",
       "prompt_number": 39,
       "text": [
        "\n",
        "  ___                                                                         \n",
        "\u2572\u2571 2 \u22c5\u27581,0\u27e9\u2a02 \u27581/2,1/2\u27e9\u2a02 \u27581/2,1/2\u27e9   \u27581,1\u27e9\u2a02 \u27581/2,-1/2\u27e9\u2a02 \u27581/2,1/2\u27e9   \u27581,1\u27e9\u2a02 \u27581/2\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "                2                                2                            \n",
        "\n",
        "                 \n",
        ",1/2\u27e9\u2a02 \u27581/2,-1/2\u27e9\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "  2              "
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Uncoupling can also be done with the `.rewrite` method:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jzc.rewrite(\"Jz\", coupled=False)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\frac{1}{2} \\sqrt{2} {{\\left|1,0\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }} + \\frac{1}{2} {{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }} + \\frac{1}{2} {{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAmYAAAAkCAYAAAAjI/bEAAAABHNCSVQICAgIfAhkiAAACyFJREFU\neJztnWvMHUUZx38thZK2b42VSwsBjrSKiqB4IwWU0IoiElGUaiRCoEalXgtoYjTa5tUUTaFQ8Ua8\nHMFLjVggsYr3Y0xI1CgqGvkgceMHUTCgURptrPXDs8d3d89eZnZ2z87ZeX7Jm/bs7Mw+z+z/mTNn\ndmYWFEVRFEVRFEVRFEVRFEXphucBhxr4UxRFURRFURz5JnBk10YoiqIoiqL4yuIpXecC4EfAv6Z0\nvb5wL3BUB9e9HFjUwXUhTJ+VNF1pwBWNG6VLQtRAL9uKaXXMtgCfnNK1+sRxwIoOrnsCsLGD60KY\nPitputKAKxo3SpeEqIEg2oo54A7gxAYNOBv4UIPlhUQEDHKOu96nqvxrgC/XLNuViHyfwc1vn31u\nI+5mmYh2NOCKzxqKCKut0JiZJCIsDUBP24rkiNkbgWuBV9PsSNq7gJsbLC90XO+TSf6H4rRj6xjY\nEi5+++xzW3HXR7qsK581VERf2wqNGXP6qoEqetdWHKK4B2rLs2i+U/b1hsvzmYjie+F6n6ryvwR4\nr0P5dYkot8vFb199hmrbVPcLNNlG2eKrhiLCaytM/NK4EfqqgYgethVt9ySvBW4oSX8BsBf4FnA/\n8Fng+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RFURRFURRFURRFURRFURRFURRFURRFURRFURRFmT7/A1TuLADP\nlUklAAAAAElFTkSuQmCC\n",
       "prompt_number": 40,
       "text": [
        "\n",
        "  ___                                                                         \n",
        "\u2572\u2571 2 \u22c5\u27581,0\u27e9\u2a02 \u27581/2,1/2\u27e9\u2a02 \u27581/2,1/2\u27e9   \u27581,1\u27e9\u2a02 \u27581/2,-1/2\u27e9\u2a02 \u27581/2,1/2\u27e9   \u27581,1\u27e9\u2a02 \u27581/2\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "                2                                2                            \n",
        "\n",
        "                 \n",
        ",1/2\u27e9\u2a02 \u27581/2,-1/2\u27e9\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "  2              "
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The `uncouple` method can also uncouple normal states if given a set of spin bases to consider:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "jz = JzKet(2, 1)\n",
      "uncouple(jz, (1, S(1)/2, S(1)/2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\frac{1}{2} \\sqrt{2} {{\\left|1,0\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }} + \\frac{1}{2} {{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }} + \\frac{1}{2} {{\\left|1,1\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},\\frac{1}{2}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},- \\frac{1}{2}\\right\\rangle }}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAmYAAAAkCAYAAAAjI/bEAAAABHNCSVQICAgIfAhkiAAACyFJREFU\neJztnWvMHUUZx38thZK2b42VSwsBjrSKiqB4IwWU0IoiElGUaiRCoEalXgtoYjTa5tUUTaFQ8Ua8\nHMFLjVggsYr3Y0xI1CgqGvkgceMHUTCgURptrPXDs8d3d89eZnZ2z87ZeX7Jm/bs7Mw+z+z/mTNn\ndmYWFEVRFEVRFEVRFEVRFEXphucBhxr4UxRFURRFURz5JnBk10YoiqIoiqL4yuIpXecC4EfAv6Z0\nvb5wL3BUB9e9HFjUwXUhTJ+VNF1pwBWNG6VLQtRAL9uKaXXMtgCfnNK1+sRxwIoOrnsCsLGD60KY\nPitputKAKxo3SpeEqIEg2oo54A7gxAYNOBv4UIPlhUQEDHKOu96nqvxrgC/XLNuViHyfwc1vn31u\nI+5mmYh2NOCKzxqKCKut0JiZJCIsDUBP24rkiNkbgWuBV9PsSNq7gJsbLC90XO+TSf6H4rRj6xjY\nEi5+++xzW3HXR7qsK581VERf2wqNGXP6qoEqetdWHKK4B2rLs2i+U/b1hsvzmYjie+F6n6ryvwR4\nr0P5dYkot8vFb199hmrbVPcLNNlG2eKrhiLCaytM/NK4EfqqgYgethVt9ySvBW4oSX8BsBf4FnA/\n8Fng+Ioyn1SStgz4tY2BMafEduwCbgRuY7InuxtYUqPsWeW7wAbCmtjrs89t6N4kf2i6d8VnDbWF\nzz5r3EwHnzXgK4V11mbHbB1w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2kh9MK5Fnz1W8ArP9Wb5D\n+QTJiEnRmd6nIn9t7/OHkc3/TGjC74j8QDOxuwuf8xhi3liY2jbKfHbVvWl+MNc9+KsBV9rSUKht\nRR5DzOLGxq5R5rOPcROqBrStEArrbAXp91NuQoZeTTaUnDYjx/zbHfJuxXwC4kakk7ee9PDlHPCm\nOO2oijIi0qKrc5+S/trmX4IEhQ2ufkdMBpqt3dP2OcsQsy8YG9tGjjZNS/fgnwZcaVtDobYVWYZU\nx42tXSNHm/T7wjx/H74vXGm0zk5HHkeujT+vRH4JbHI2s3lGjvltXpCeZDGyd5sNS5Fnx7uAG+N/\nP0r5BrpJItKiq3Ofkv7a5r+Eejsmu/gdMRlotnZ34XOS3Uy+1SIPG9tGjjZNU/fglwZcmYaGQm0r\nkpjEja1dI0eb9PsirO8LVxqts0WkJ8CfGhd2RlGGDjGdAJjHC4HX1cx7CfBah2vXISItOtv7lPXX\nNv+dyBLeaRIxGWg2ds+Szza2hax7cNOAKz5raExEGG2FrV0hx01fNZAkIqC24nbs9yObFnM18y1B\neuNFqyKq2I3bvm91iCgf2i+7Tyb+luU/GRlGnjYR1Y8ziuyeVZ/HlNmmuk/jogFXfNRQRHhtBVR/\nV2ncLNBHDUQE0lZsRoYR2zRWMSOiWHSu96kq/w662cgwojzQXPz21WfQuEsS0Z4GXPFVQxHhtRUa\nM2kiwtNARABtxUVxYSCrLAeulilOROTfA9f7VJX/cORNDF0QUeyPi98++6xxlyaiHQ244rOGIsJq\nKzRmJokISwPQ07YiufvuucCxyLYRq4ELkD2+FL9wvU8m+S8G7na2tFlc/PbZZ407c7qsK581VERf\n2wqNGXP6qoEqetFWnIy8EzK7n9jKBo1V7LmX9FJh1/tkmv8WizKbJuszuPnts88ad/k0rQFXfNbQ\nmFDaCo2ZYkLRQBJtKxRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFmT7/A1TuLADP\nlUklAAAAAElFTkSuQmCC\n",
       "prompt_number": 41,
       "text": [
        "\n",
        "  ___                                                                         \n",
        "\u2572\u2571 2 \u22c5\u27581,0\u27e9\u2a02 \u27581/2,1/2\u27e9\u2a02 \u27581/2,1/2\u27e9   \u27581,1\u27e9\u2a02 \u27581/2,-1/2\u27e9\u2a02 \u27581/2,1/2\u27e9   \u27581,1\u27e9\u2a02 \u27581/2\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "                2                                2                            \n",
        "\n",
        "                 \n",
        ",1/2\u27e9\u2a02 \u27581/2,-1/2\u27e9\n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "  2              "
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## Example: Spin-orbit Coupling\n",
      "\n",
      "If we start with a hydrogen atom, i.e. a nucleus of charge $Ze$ orbited by a single electron of charge $e$ with reduced mass $\\mu$, ignoring energy from center-of-mass motion, we can write the Hamiltonian in terms of the relative momentum, $p$, and position, $r$, as:\n",
      "\n",
      "$$H=\\frac{p^2}{2\\mu} - \\frac{Ze^2}{r}$$\n",
      "\n",
      "The resulting eigenfunctions have a separate radial and angular compents, $\\psi=R_{n,l}(r)Y_{l,m}(\\phi,\\theta)$. While the radial component is a complicated function involving Laguere polynomials, the radial part is the familiar spherical harmonics with orbital angular momentum $\\vec{L}$, where $l$ and $m$ give the orbital angular momentum quantum numbers. We represent this as a angular momentum state:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "l, ml = symbols('l m_l')\n",
      "orbit = JzKet(l, ml); orbit"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$${\\left|l,m_{l}\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAC8AAAAaCAYAAAAnkAWyAAAABHNCSVQICAgIfAhkiAAAAppJREFU\nWIXt102MjVcYB/DfGJQQbTTxsTJFohqfESRidEYmTRtNRRRLhETCykdiJWFlg7AgFixESrS1E1qL\nZto0bYVFg4aIz1j4WpAgxBAW50zmde57e8/lioX5Jzfve/7Pc57zP885zzn3pRfvFDswsMzQJ2n/\nXOLzA+7iJT5rrK4sdGJJrmMZtuNmg8TUi2b8WGZIM18Nc/B7w+TUhxe4iAmpIUf8EEz1/sTDfqxM\nyRzxrcLSvU/xNzBcUrh9Mzq24xYuZfjORwcmYymGYpFQ7LOwDSewFp9iGPpjObpqxP4Ji3GgmkNn\nCXcGhzOE98fO+H4af2I9miK3UTi1tqMlcs14KEy0FvrhaJGotW0+xhR5W+bLKLgJo3E7Cn0Z7V3C\nShzC9ci9iL/hGfG7hNWvKNxudCbtb+Pg4zOCjxT25KTYpzWxH8ZfCTc6+s7LiA9j9Kxuzcy34w4u\nZAS+hSeYG5+nEnubyuR8jafyD4MrGNvdqCW+DX/E95zsEyb8N54VuPEYoVL8AvyCRxgl1MD/YQyu\nVjMWgw8W9uOa2N6b+I7DgITrg/vYlPCrhckMKnBD8Rzfx/ae+PwK/wr1kmIrJhYHq4Zu22XMxD8F\nW7tw6x1M+kzFJyoz3C6cQI8LXIuQ6ZOYjv8ifxIP8GsSox8+x7lqgtNBN+A4dnl9ol/gHq4l/t/h\nvHBspnFXJVyzcHbvxeZC/EFRfLqqC7GsmvAy8bWwpU7/HHwjXGQpjkhu2Nw/ZtXw0Vv2L0OHyi3T\nItwbT4rk24hvFQqr0egQTqAiVmBfrY6dmQP0Fb5wmmo51olheupocGGsso+kN878c6zTc/U3CrPx\nG6ZhRuTm4ViZcyp+d4PF1IuzQqbn6tkFbap8SfWiFx8aXgFjVHm5OC1AbAAAAABJRU5ErkJggg==\n",
       "prompt_number": 42,
       "text": [
        "\u2758l,m_l\u27e9"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Now, the spin orbit interaction arises from the electron experiencing a magnetic field as it orbits the electrically charged nucleus. This magnetic field is:\n",
      "\n",
      "$$\\vec{B} = \\frac{1}{c}\\frac{Ze\\vec{v}\\times\\vec{r}}{r^3} = \\frac{Ze\\vec{p}\\times\\vec{r}}{mcr^3}=\\frac{Ze\\vec{L}}{mc\\hbar r^3}$$\n",
      "\n",
      "Then the spin-orbit Hamiltonian can be written, using the electron's magnetic dipole moment $\\mu$, as:\n",
      "\n",
      "$$H_{SO} = -\\vec{\\mu}\\cdot\\vec{B} = -\\left(-\\frac{g\\mu_B \\vec{S}}{\\hbar}\\right)\\cdot\\left(\\frac{Ze\\vec{L}}{mc\\hbar r^3}\\right)$$\n",
      "\n",
      "Ignoring the radial term:\n",
      "\n",
      "$$\\propto \\vec{L}\\cdot\\vec{S} = J^2 - L^2 - S^2$$\n",
      "\n",
      "for $\\vec{J}$, the coupled angular momentum.\n",
      "\n",
      "The electron spin angular momentum is given as $\\vec{S}$, where the spin wavefunction is:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "ms = symbols('m_s')\n",
      "spin = JzKet(S(1)/2, ms); spin"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$${\\left|\\frac{1}{2},m_{s}\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAADgAAAAgCAYAAABHA7voAAAABHNCSVQICAgIfAhkiAAAAwpJREFU\nWIXt2F2IVVUUB/DftUnyayTzs6iG6SEiMEpF8HtKYiDDD1CCqCjtpXqRHuZVRUH8wgff/AiSLJhQ\nhKJPoiAL6anE9/NWiSloaCR6fVjn6p1zz9w558610Wn+cOCctfbae/332mvvtQ//Q/yE6SPtRAm8\njspgynE5socxOUc+BZ/isfb41TY8ihfKGCToysg2YQuqObqRxhwcK2OQGJzE3UgQPsGsPEXeEr0X\ncQRv5SlGC8Fv8LyczWa0EKziW7yYVYwWgvAB3swKRxPBc7gudtVb6Cho/CqWpO878SMOFLRdjZV4\nBm9gGtaLZbUIe/AFNuMhzMR4EY1rBceo4TA2YnuzRon2HQXjsT99/0VMzPtubwZ9Yub31o15Hy6L\nySiLithwbq3MO71ElwtSFXTjD0GmmuqviYgeExNLLLPrBjnXhkAVX6G3WaNE+yI4BxMwNx18aUb/\nsah969Gdtn2pxTGno7/2cacj+DuuijPqKk5n9CvwfUbWi3/wQ4tjnhe8HqQYwWqBZyj04Gf8Wyd7\nCrM1ElyLL/E3Hhc5WQYdmIqLFCNYKfDU8CQeyNiPwzKNRHpEDp6qk01L5R+l330iH8tgFT5r1iDR\nWg72iGj2Z+Tz5Odfv4Hk4Lm0bScW4N0W/DguJgrFz8Ei+FOs//kZ+SM4qzH/ZuDDjOxXcefcJXbc\nbSV96MIlXGjWKNEYwYXiIN4izpllTey3lnSqDF7GO3hN/u1hBxYP1UliIMHJonqpYQOuiMjkYecg\n8uFiCn5L32eI6qceHfi6SEeJgQTn4gaeSL87RZ5syLFdileKDNICJqS+nRHlXbYQWIf3inSUGEiw\nIpZobbd8WhB8NmPXgX2a/AAaJiqC5Bp8p3GlnBDHw5BINN9Fj4py679EF/4StS1RrNdHqxuH8gzL\n7qIbRXXSV9JuuDiP3SItJmKS20U8vI2DRTtL5EdwlSBIHOZ5bUYC94vKJxdFa9HlIqk/F+VVr8zF\ncgSxGifLGGT/bHeL+1m2/uxsk4PDxQF3jy9jGMMYMrgJOdmQt/74E/MAAAAASUVORK5CYII=\n",
       "prompt_number": 43,
       "text": [
        "\u27581/2,m_s\u27e9"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "From this we build our uncoupled state:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "state = TensorProduct(orbit, spin); state"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$${{\\left|l,m_{l}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},m_{s}\\right\\rangle }}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAHsAAAAgCAYAAAAyjgdLAAAABHNCSVQICAgIfAhkiAAABYdJREFU\naIHt22usXUUVwPFfubdApb0GxEoJyKUFFdFGaAwhvEpRqOFdpBgNQuQVCh9oLNEECBBCgAhGXgo+\nquENBYEPoPjKgaiEYIKCiYQEPIkRlEfASKhS6vXD2od775y9z5lzex69yfknNz0zs/bM2jOzZtas\nPWXIkCF+j50HrUSHfBVzqgq36aMis41dMb8kfwHux0f7q04Wu+OIQSsxG6ljPMk7E5dhoqRsa2AR\n7hq0ElvCtzFvAO3WVQ/o1jrYcA8+UlaQLuP3l8jciVfFC+7ZXb2yqOGUAbQ7W1mPr+UI1iryr8Pf\nuqVNh4zgvgG0Wzc7LXsOfqnEUct10A7F493UqAM243l8akDtzzYm8CscmRaMZjw8hv3w/S4r1Qk/\nwlpc0MEz22E1lokOmMB/8RCe6raCWxk/xg14rJVQrSTvaNFRH+u+Th1xt3xH7fPihQ8yfTlbgHPE\nxP1QmzrqZucy3uBO4Z1XUivJuxYvZzZwPG7EE8KZW4arcZXYBo4Vq8mFRf563IG5GXWvwmkZcifi\nGa2dybViX9uphUxd84B+Bd8Tg30Pzs/QZyq97J+UFbi4lUCtJO8PwqrasS2+U/x+Gr/F101a1jeE\nV3+dyU4cwb/lDeJcPNBGZhdh0R8QS/8nSmTOFeflcTFwVdR113p73T8pDUftfb+snYP2QXxGnnN2\nmHiBOViMfwjFJ4ryTcKS7hIdSThfm1WcCxM24QWtHbU1uAbviEFdK/yNBu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RZr1lPXbllH2Mynr59hcygmCucxlKG98Y74zDhED0iwpsr\ntbkg0GeOx8ODVmI2kv6PkMXi23IaDx/rv2qV3GTr0mfIkCFDhgwZMgP+D8enOQ4jSfDWAAAAAElF\nTkSuQmCC\n",
       "prompt_number": 44,
       "text": [
        "\u2758l,m_l\u27e9\u2a02 \u27581/2,m_s\u27e9"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "For clarity we will define $L^2$ and $S^2$ operators. These behave the same as `J2`, they only display differently."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "L2 = J2Op('L')\n",
      "S2 = J2Op('S')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 45
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "We also have the spin-orbit Hamiltonian:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "hso = J2 - TensorProduct(L2, 1) - TensorProduct(1, S2); hso"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$J^2 - {1}\\otimes {S^2} - {L^2}\\otimes {1}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAKoAAAAZCAYAAAChKLVZAAAABHNCSVQICAgIfAhkiAAABIhJREFU\neJzt2luoVFUcx/HP8ViWmpaZWhGWvSilKVFp5YWkKJSoIIOiJ9OSfCjoIlRIdrNSCiqk+5AvPpWE\nlZcu2EMXArML+GBlT0VYgZhBmZ4e/jM6Z5g5e8+ePTNndL5w2Gfvdfuv33/tvf5rraFLlw6gJ2O5\ny3A5RuMKPIZP8zKqw+kkbTrJ1roZidVl94vwN85ujzmDik7SppNszcQ0HMb5xftR6BMdPd7pJG06\nydZM9IgpoxQ2XCA6OKNtFg0eOkmbTrI1kRnYhi/F29eHb7C0LM96rG2xXcPxbYvbLHESHsImbMA7\nWCGm0k0VeVutzRC8i13CV//hC+HDWQ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Vp2W3DVDueun2+LaKMKeS0vbTzeKIdHvRji3ipKrdTBZ27Raa7BO2bRba\n7HFUr0ubZEOjGmf17THHfLwmYsDKU5OlxbSxbbDrWKKpGrf71zKtZBhuEfFTn+j7QTFzfNZGu44l\nuhp36dKlS5cuXbp0OW74H3nWOWF+Ncp/AAAAAElFTkSuQmCC\n",
       "prompt_number": 46,
       "text": [
        "\n",
        " 2       2    2   \n",
        "J  - 1\u2a02 S  - L \u2a02 1"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Now we apply this to our state:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "apply1 = qapply(hso * state); apply1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$- \\hbar^{2} l^{2} {{\\left|l,m_{l}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},m_{s}\\right\\rangle }} - \\hbar^{2} l {{\\left|l,m_{l}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},m_{s}\\right\\rangle }} + J^2 {{\\left|l,m_{l}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},m_{s}\\right\\rangle }} - \\frac{3}{4} \\hbar^{2} {{\\left|l,m_{l}\\right\\rangle }}\\otimes {{\\left|\\frac{1}{2},m_{s}\\right\\rangle }}$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAqIAAAAhCAYAAAACusmsAAAABHNCSVQICAgIfAhkiAAADGxJREFU\neJztnXmwHEUdgL+XlxCSvCQaEYNB8gh4ABINqCQlOQ2IJCRgcVgaEEwMl38YSSQUWgSvRCSJligi\naB4q4TCJQcEDChwojVgR7wOrVMbCAkHU4lIgJs8/fjO1s7MzszM73XPs/r6qV2+np7ent/ebnu2e\n7h5QFEVRFEVRlB7gOGAVsA64G5hTam56j13AAWVnIgPnAH1lZ8JD3TWP+qhUFXXTLlqfdk7d3IQK\n+TkAbAhsn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xk9Tz5rvFka3j5KZ\nhcBZEeHLEenScg9ye+MsRLRhROQ9SC9JJ8/bnYas9XY98GdkEeIxSGvltoj4NsoHZLzJBOA3wA+A\nc0P7l9B8u6dXsFXeUU6qjw2K8PFppPeorqib3etmEhORVSBsDQsxRVHX8jq6CXbKp52b0KPXcidD\n3NnAuwwf/0AaXeADgfCRwDbDx0qDS3NLqg/p0vdbZkcR/4xgG+UTzMcYZCbdvTS37kAGgk+0dOwi\ncTLEtVXeUU6qj830io9BnAxx1c3edXMN8iPGobo9okVdy+voJtjzs52bEOOnlWd91pCRyHNgbzWc\n7vHIF3IssmagzyKSF78timFkzTB/eYe1wCaaB1GDvfIBOaGeRGZB7kQGcv8tsH8ashzIUxaOXVVs\nlneUk+pjg0HUxyTUTaEX3VyC3G59wVL6JijyWl43N8Fe+QyS7Cb0cN15RsnHPxxZ0HoNzT/6N9O8\nzlpRuMSPS1sOXEX6xY5NMYCcOMuQMTKrQnlYT3EL+9qmbB8h2kn1sUEv+RhE3WzGRd0M8krgnMC2\nQ7E9omX7qW4m085N6N66U8mIS7TAi2k8Tmz/mDhlMAoZ76J0Jy7qo1JNXNTNIOcBlyE/NtYCjyLj\nGfM84lHpDJd6uQlt/NTJSspc5FnAdwKTkSe5PI7IXjZLab8+m9JdqI9KVellN8OPeLwA2Er22eyK\nHarsJmjdqQTYRfPSENOAZ2h9HNiE4rMWyTVUJy+KedRHpaqom9EcjNz6fR74DtILpxRL3dwErTsV\nRVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURVEURSmC/wOumnJ1lMu6vAAAAABJRU5E\nrkJggg==\n",
       "prompt_number": 47,
       "text": [
        "\n",
        "                                                                              \n",
        "   2  2                       2                         2                     \n",
        "- \u210f \u22c5l \u22c5\u2758l,m_l\u27e9\u2a02 \u27581/2,m_s\u27e9 - \u210f \u22c5l\u22c5\u2758l,m_l\u27e9\u2a02 \u27581/2,m_s\u27e9 + J \u22c5\u2758l,m_l\u27e9\u2a02 \u27581/2,m_s\u27e9 -\n",
        "                                                                              \n",
        "\n",
        "    2                   \n",
        " 3\u22c5\u210f \u22c5\u2758l,m_l\u27e9\u2a02 \u27581/2,m_s\u27e9\n",
        " \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "            4           "
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Note this has not applied the coupled $J^2$ operator to the states, so we couple the states and apply again:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "apply2 = qapply(couple(apply1)); apply2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$- \\hbar^{2} l^{2} \\sum_{j=m_{l} + m_{s}}^{l + \\frac{1}{2}} C^{j,m_{l} + m_{s}}_{l,m_{l},\\frac{1}{2},m_{s}} {\\left|j,m_{l} + m_{s},j_{1}=l,j_{2}=\\frac{1}{2}\\right\\rangle } - \\hbar^{2} l \\sum_{j=m_{l} + m_{s}}^{l + \\frac{1}{2}} C^{j,m_{l} + m_{s}}_{l,m_{l},\\frac{1}{2},m_{s}} {\\left|j,m_{l} + m_{s},j_{1}=l,j_{2}=\\frac{1}{2}\\right\\rangle } - \\frac{3}{4} \\hbar^{2} \\sum_{j=m_{l} + m_{s}}^{l + \\frac{1}{2}} C^{j,m_{l} + m_{s}}_{l,m_{l},\\frac{1}{2},m_{s}} {\\left|j,m_{l} + m_{s},j_{1}=l,j_{2}=\\frac{1}{2}\\right\\rangle } + \\sum_{j=m_{l} + m_{s}}^{l + \\frac{1}{2}} \\left(\\hbar^{2} j^{2} C^{j,m_{l} + m_{s}}_{l,m_{l},\\frac{1}{2},m_{s}} {\\left|j,m_{l} + m_{s},j_{1}=l,j_{2}=\\frac{1}{2}\\right\\rangle } + \\hbar^{2} j C^{j,m_{l} + m_{s}}_{l,m_{l},\\frac{1}{2},m_{s}} {\\left|j,m_{l} + m_{s},j_{1}=l,j_{2}=\\frac{1}{2}\\right\\rangle }\\right)$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAB24AAABKCAYAAABzXXRYAAAABHNCSVQICAgIfAhkiAAAIABJREFU\neJzt3Xu0LGV55/HvuQCCBxhQ8ShREE0QFBwVgyjiEVAEFYFBdJCAFxwTQUdFYxg1s01AEMU4Bh3v\nbqOjUYy3ZCJeoltE0WU0Rh0l3tJjYhSD0YATUSNn/ni67d69+1Jd17eqv5+19jp9qV3vs+t0/56u\n7uq3QJIkSZIkSZIkSZKkJbQZeHnTRUiSamPuS9LysgdIUprMZ0mSJCVna9MFLKG9gScDOxquQ5JU\nD3NfkpaXPUCS0mQ+S5IkSVpnrekCJEm1Wmu6AElSY9aaLkCSNNFa0wVIkiRJozY3XYAkSZIkSZIk\nSZIkLTs/uF3Mw4AvApc3XYgkqXJmviQtL3uAJKXJfJYkSVKn+cHtYj4M/Bj40Jzlzq+hFklStbJm\nPpj7ktQ19gBJSpP5LEmSpE7zg9vF3Br4j8DVc5a7bQ21SJKqlTXzwdyXpK6xB0hSmsxnSZIkdZof\n3C7mGOBa4OYC69gdeCZwCPDs/nVJUnrKyHww9yWpjewBkpQm81mSJEnSr1xOvLCfZ6XiOiRJ1cua\n+WDuS1LX2AMkKU3msyRJkjpta9MFtMzxwGPHbrs9sdOwaeS2o4FbjVy/Cbi42tIkSSWblPlg7kvS\nMrAHSFKazGdJkiRJAOwH/H3/8rY5y67MuG/njB9JUhoWyXww9yWpS+wBkpQm81mSJEmd5zduszsa\n+BhwX2Dv/uU8tgDnMTx/ymXFS5MklayszAdzX5Laxh4gSWkynyVJktR5m5suoEW+RHzQfSywVmA9\njwDeR+wUHEnscEiS0lJW5oO5L0ltYw+QpDSZz5IkSeo8P7jN7pvAOcBLgVvmLPvTGffdFfjP/cvf\nAu5UvDRJUskWyXww9yWpS+wBkpQm81mSJElS6XYD9uxf/hBwxw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RJkiRJkiRJkiRJkiRJkiRJkiRJ\nkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJ7fL/AWERTP06yLvtAAAAAElFTkSuQmCC\n",
       "prompt_number": 48,
       "text": [
        "\n",
        "                                                                              \n",
        "                                                                              \n",
        "                                                                              \n",
        "                                                                              \n",
        "                                                                              \n",
        "           l + 1/2                                                       l + 1\n",
        "             ____                                                          ___\n",
        "             \u2572                                                             \u2572  \n",
        "              \u2572        j,m_l + m_s                                          \u2572 \n",
        "   2  2        \u2572      C             \u22c5\u2758j,m_l + m_s,j\u2081=l,j\u2082=1/2\u27e9    2          \u2572\n",
        "- \u210f \u22c5l \u22c5       \u2571       l,m_l,1/2,m_s                           - \u210f \u22c5l\u22c5       \u2571\n",
        "              \u2571                                                             \u2571 \n",
        "             \u2571                                                             \u2571  \n",
        "             \u203e\u203e\u203e\u203e                                                          \u203e\u203e\u203e\n",
        "        j = m_l + m_s                                                 j = m_l \n",
        "\n",
        "                                                         l + 1/2              \n",
        "                                                           ____               \n",
        "                                                           \u2572                  \n",
        "                                                            \u2572        j,m_l + m\n",
        "                                                    2        \u2572      C         \n",
        "/2                                               3\u22c5\u210f \u22c5       \u2571       l,m_l,1/2\n",
        "_                                                           \u2571                 \n",
        "                                                           \u2571                  \n",
        "       j,m_l + m_s                                         \u203e\u203e\u203e\u203e               \n",
        "      C             \u22c5\u2758j,m_l + m_s,j\u2081=l,j\u2082=1/2\u27e9        j = m_l + m_s           \n",
        "       l,m_l,1/2,m_s                           - \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "                                                                              \n",
        "                                                                              \n",
        "\u203e                                                                             \n",
        "+ m_s                                                                         \n",
        "\n",
        "                                                                              \n",
        "                                                                              \n",
        "                                                                              \n",
        "_s                                                                            \n",
        "    \u22c5\u2758j,m_l + m_s,j\u2081=l,j\u2082=1/2\u27e9                                                \n",
        ",m_s                                l + 1/2                                   \n",
        "                                      ____                                    \n",
        "                                      \u2572                                       \n",
        "                                       \u2572       \u239b 2  2  j,m_l + m_s            \n",
        "                                        \u2572      \u239c\u210f \u22c5j \u22c5C             \u22c5\u2758j,m_l + \n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 +        \u2571      \u239d       l,m_l,1/2,m_s          \n",
        "4                                      \u2571                                      \n",
        "                                      \u2571                                       \n",
        "                                      \u203e\u203e\u203e\u203e                                    \n",
        "                                 j = m_l + m_s                                \n",
        "\n",
        "                                                                 \n",
        "                                                                 \n",
        "                                                                 \n",
        "                                                                 \n",
        "                                                                 \n",
        "                                                                 \n",
        "                                                                 \n",
        "                                                                 \n",
        "                    2    j,m_l + m_s                            \u239e\n",
        "m_s,j\u2081=l,j\u2082=1/2\u27e9 + \u210f \u22c5j\u22c5C             \u22c5\u2758j,m_l + m_s,j\u2081=l,j\u2082=1/2\u27e9\u239f\n",
        "                         l,m_l,1/2,m_s                          \u23a0\n",
        "                                                                 \n",
        "                                                                 \n",
        "                                                                 \n",
        "                                                                 "
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "We now collect the terms of the sum, since they share the same limits, and factor the result:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "subs = []\n",
      "for sum_term in apply2.atoms(Sum):\n",
      "    subs.append((sum_term, sum_term.function))\n",
      "    limits = sum_term.limits\n",
      "final = Sum(factor(apply2.subs(subs)), limits)\n",
      "final"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\sum_{j=m_{l} + m_{s}}^{l + \\frac{1}{2}} \\frac{1}{4} \\hbar^{2} \\left(4 j^{2} + 4 j - 4 l^{2} - 4 l -3\\right) C^{j,m_{l} + m_{s}}_{l,m_{l},\\frac{1}{2},m_{s}} {\\left|j,m_{l} + m_{s},j_{1}=l,j_{2}=\\frac{1}{2}\\right\\rangle }$$"
       ],
       "output_type": "pyout",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAioAAABKCAYAAACVW3/AAAAABHNCSVQICAgIfAhkiAAAE+VJREFU\neJztnXmUJWV5h5+enhkcZssMywzrDCORMDoIETOCMBvIEnYOIkGCIHBUIEoQMkHU0yQjwpDROEEM\nitCEiBpQFkUWBZtF0BAMWxQFpROVLSKbKJuQP351c6tvV93aq25P/55z6nRX3br1vVXd31fv937v\nAsYYY4wxphATgE81LYQxxhhj6mVi0wKkYCZwDLCsYTmMMcYYY2IZaloAY4wxxtTLhKYFMMYYY4yJ\no2pFZQ/gbmBNxe0YY4wxZh2kakXlBuBp4PqE806sWA5jjDHGjEGqVlSmAtsDtySct2HFchhjjDFm\nDFK1orIEuAN4ocA1pgAnAdsCJwf7xhhjjDGFWYOUjCQGKpbDGGOMMWOQqvOo7A68q+PYHKS89IWO\n7QK8LrT/HPCJakUzxhhjzHhmY+Dh4PdpCecOdPnstS6bMcYYY9ZhqrSo7ALcBLwFZZe9Ked1+oET\naPumrC4umjHGGGPGAlU6096LFKEVFMsquw9wJVJQFiPFxxhjjDHjgCoVlYeA9wDnAK8mnPv7Lp+9\nHviL4PefAVsUF80YY4wxphzWA6YHv18PbNqgLMYYY4ypkf6mBUjBH4CXgF2RZebaZsUxxhhjjBnJ\nTODjTQthjDHGGBPFCcCkYNu9YVmMMcYYY/6fw4FngV8DTwFvalYcY4wxxhhjjDHGGGOMMcYYY4wx\nxhjTQzxA9zo9Rbdz6rsVY4wxxqxrHEZbqXge2DbFd/pRFeXpwGbAImA34EPARcDjoWv+Bli/dKmN\nMcYYM264gLZicS/twoJ5mQjsB9wcXPN9Ba9njBm7rAVObloIY8zYZn3gR7SVlfNLvPZfI+XHGDM+\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oTHFOTcehztbNHX0g4iCF/rJJRaHGRN6cyQXLRdUJbu3ZAfXLeSEcaYMcxA0wIY\nYxonb8X0uUjxibrWerSLKV6PIgDLarfFahTZUGcVbmPGPJ0+KoeiDrsEzQZazEazmm7hzK+g5DIv\n00z4XlOhisaY+uhHETZ52AspIfOA/+641ovBtitKR/BIie2CfFpuRH4mf4fyeRhjMrIY1ZiZADxW\n8FpVhe8NNNCmMaZ3OIz8JemPRMXs5sdcaybw8QraBdUsOwyVxYjKCWOMSUFrvXUHVKm1CGWE781B\nZtKzQtttHfunl9ymMWb8cgKa7EwifSFVY0zFhJd+Hg1+Lgdu6ThvA1RqOu3STxnhe48jp7MwA8Rb\nVZoIGTTGrBscjiZGZ6Blnl2bFccY042rKad+Q56wwY8mXHOg5DaNMcYY08NM6NjvB94G3FHCtbcG\nbgh+70PFy24P9l8I2jgK+FboO0VT6OZp0xhjjDFjhB1RfoAmCOc3iGNlBe06t4ExxhjTo0xAL+cL\nkDPq4bQrB9fJXOAJkitanl1B23siX5YrkX+NMcYYY3qEfuS78UGksDxHM+WqDwF+inKcPFNjuwcF\n7d6PLCqOCDLGGGN6iInAk8DbG5bjVWTRSVr6KZvHgS2RwnZhzW0bY4wxxhhjjDHGGGOMMcYYY4wx\nxhhjjDHGGGOMMcYYE83/AYh0fTKA9a30AAAAAElFTkSuQmCC\n",
       "prompt_number": 49,
       "text": [
        "\n",
        "   l + 1/2                                                                    \n",
        "    _____                                                                     \n",
        "    \u2572                                                                         \n",
        "     \u2572         2 \u239b   2            2          \u239e  j,m_l + m_s                   \n",
        "      \u2572       \u210f \u22c5\u239d4\u22c5j  + 4\u22c5j - 4\u22c5l  - 4\u22c5l - 3\u23a0\u22c5C             \u22c5\u2758j,m_l + m_s,j\u2081=\n",
        "       \u2572                                        l,m_l,1/2,m_s                 \n",
        "       \u2571      \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "      \u2571                                           4                           \n",
        "     \u2571                                                                        \n",
        "    \u2571                                                                         \n",
        "    \u203e\u203e\u203e\u203e\u203e                                                                     \n",
        "j = m_l + m_s                                                                 \n",
        "\n",
        "         \n",
        "         \n",
        "         \n",
        "         \n",
        "l,j\u2082=1/2\u27e9\n",
        "         \n",
        "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n",
        "         \n",
        "         \n",
        "         \n",
        "         \n",
        "         "
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "This gives us the modification of the angular part of the spin-orbit Hamiltonian. We see there is now the new $j$ quantum number in the coupled states, which we see from looking at the equation will have values $l\\pm \\frac{1}{2}$, and $m_j=m_l + m_s$. We still have the $l$ and $s$ quantum numbers."
     ]
    }
   ],
   "metadata": {}
  }
 ]
}